WIP Metadata class.

This commit is contained in:
Ahmed Bouhuolia
2019-09-08 02:41:46 +02:00
parent 70809cb05c
commit 9a8de9ca7d
29 changed files with 1707 additions and 98 deletions

38
server/src/models/Auth.js Normal file
View File

@@ -0,0 +1,38 @@
export default class Auth {
/**
* Retrieve the authenticated user.
*/
static get user() {
return null;
}
/**
* Sets the authenticated user.
* @param {User} user
*/
static setAuthenticatedUser(user) {
this.user = user;
}
/**
* Retrieve the authenticated user ID.
*/
static userId() {
if (!this.user) {
return false;
}
return this.user.id;
}
/**
* Whether the user is logged or not.
*/
static isLogged() {
return !!this.user;
}
static loggedOut() {
this.user = null;
}
}