1
0
mirror of https://github.com/Unleash/unleash.git synced 2024-12-28 00:06:53 +01:00
unleash.unleash/lib/user.js

22 lines
542 B
JavaScript
Raw Normal View History

'use strict';
const gravatarUrl = require('gravatar-url');
2020-01-02 19:23:52 +01:00
const Joi = require('@hapi/joi');
module.exports = class User {
constructor({ name, email, permissions, imageUrl } = {}) {
2018-01-17 09:27:47 +01:00
Joi.assert(
email,
Joi.string()
.email()
.required(),
'Email'
);
this.email = email;
this.name = name;
this.permissions = permissions;
this.imageUrl =
imageUrl || gravatarUrl(email, { size: '42', default: 'retro' });
}
};