33 lines
891 B
JavaScript
33 lines
891 B
JavaScript
(function () {
|
|
'use strict';
|
|
|
|
angular.module('soter').service('Session', Session);
|
|
|
|
function Session() {
|
|
this.create = function (sessionId, userId, name, permissions) {
|
|
this.id = sessionId;
|
|
this.userId = userId;
|
|
this.name = name;
|
|
this.permissions = permissions;
|
|
this.isAuthenticated = true;
|
|
};
|
|
this.destroy = function () {
|
|
this.id = null;
|
|
this.userId = null;
|
|
this.name = null;
|
|
this.permissions = null;
|
|
this.isAuthenticated = false;
|
|
};
|
|
this.data = function () {
|
|
return {
|
|
id: this.id,
|
|
userId: this.userId,
|
|
name: this.name,
|
|
permissions: this.permissions,
|
|
isAuthenticated: this.isAuthenticated
|
|
}
|
|
}
|
|
}
|
|
})();
|
|
|