1 |
|
2 |
|
3 |
|
4 | 'use strict';
|
5 |
|
6 | const Base = require('../base/Base');
|
7 |
|
8 | module.exports = class Identity extends Base {
|
9 |
|
10 | getId () {
|
11 | return this.get(this.PK);
|
12 | }
|
13 |
|
14 | getTitle () {
|
15 | return this.getId();
|
16 | }
|
17 |
|
18 | getAssignments () {
|
19 |
|
20 | return this.module.get('rbac').getUserAssignments(this.getId());
|
21 | }
|
22 |
|
23 | getAuthKey () {
|
24 | return this.get('authKey');
|
25 | }
|
26 |
|
27 | setAuthKey () {
|
28 | this.set('authKey', SecurityHelper.getRandomString(16));
|
29 | }
|
30 |
|
31 | checkAuthKey (key) {
|
32 | return this.getAuthKey() === key;
|
33 | }
|
34 | };
|
35 |
|
36 | const SecurityHelper = require('../helper/SecurityHelper'); |
\ | No newline at end of file |