mirror of
https://github.com/LaCasemate/fab-manager.git
synced 2024-12-02 13:24:20 +01:00
927479733b
see https://github.com/omniauth/omniauth/wiki/Resolving-CVE-2015-9284 for more info
18 lines
483 B
Plaintext
18 lines
483 B
Plaintext
'use strict';
|
|
|
|
Application.Services.factory('AuthService', ['Session', 'CSRF', function (Session, CSRF) {
|
|
return {
|
|
isAuthenticated () {
|
|
return (Session.currentUser != null) && (Session.currentUser.id != null);
|
|
},
|
|
|
|
isAuthorized (authorizedRoles) {
|
|
if (!angular.isArray(authorizedRoles)) {
|
|
authorizedRoles = [authorizedRoles];
|
|
}
|
|
|
|
return this.isAuthenticated() && (authorizedRoles.indexOf(Session.currentUser.role) !== -1);
|
|
}
|
|
};
|
|
}]);
|