forked from projectcaluma/ember-emeis
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathscope.js
More file actions
27 lines (23 loc) · 729 Bytes
/
Copy pathscope.js
File metadata and controls
27 lines (23 loc) · 729 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
import { attr, belongsTo, hasMany } from "@ember-data/model";
import localizedAttr from "ember-emeis/decorators/localized-attr";
import LocalizedModel from "ember-emeis/models/localized";
export default class ScopeModel extends LocalizedModel {
@localizedAttr name;
@localizedAttr fullName;
@localizedAttr description;
@attr level;
@attr metainfo;
@attr isActive;
@belongsTo("scope", { inverse: "children", async: false }) parent;
@hasMany("scope", { inverse: "parent", async: false }) children;
@hasMany("acl") acls;
findParents() {
const anchestors = [];
let node = this;
while (node.parent) {
anchestors.push(node.parent);
node = node.parent;
}
return anchestors;
}
}