@@ -13,6 +13,7 @@ export class WellknownIds {
1313 static robot_users : string = "5aef0142f3683977b0aa3dd3" ;
1414 static robot_admins : string = "5aef0142f3683977b0aa3dd2" ;
1515
16+ static personal_nodered_users : string = "5a23f18a2e8987292ddbe062" ;
1617}
1718export class Rights {
1819 static create = 1 ;
@@ -23,20 +24,20 @@ export class Rights {
2324 static full_control = - 1 ;
2425}
2526interface IBase {
26- _id :string ;
27- _type :string ;
28- name :string ;
29- getRight ( _id :string , deny :boolean ) :Ace ;
30- addRight ( _id :string , name :string , Rights :number [ ] , deny :boolean ) :void ;
31- removeRight ( _id :string , Rights :number [ ] , deny :boolean ) :void ;
27+ _id : string ;
28+ _type : string ;
29+ name : string ;
30+ getRight ( _id : string , deny : boolean ) : Ace ;
31+ addRight ( _id : string , name : string , Rights : number [ ] , deny : boolean ) : void ;
32+ removeRight ( _id : string , Rights : number [ ] , deny : boolean ) : void ;
3233}
3334export class Base implements IBase {
34- _id :string ;
35- _type :string = "unknown" ;
36- _acl :Ace [ ] = [ ] ;
37- name :string ;
38- _name :string ;
39- _encrypt :string [ ] = [ ] ;
35+ _id : string ;
36+ _type : string = "unknown" ;
37+ _acl : Ace [ ] = [ ] ;
38+ name : string ;
39+ _name : string ;
40+ _encrypt : string [ ] = [ ] ;
4041
4142 _createdbyid : string ;
4243 _createdby : string ;
@@ -53,7 +54,7 @@ export class Base implements IBase {
5354 * @param {T } o Base object
5455 * @returns T New object as Type
5556 */
56- static assign < T > ( o :T ) : T {
57+ static assign < T > ( o : T ) : T {
5758 return Object . assign ( new Base ( ) , o ) ;
5859 }
5960 /**
@@ -62,16 +63,16 @@ export class Base implements IBase {
6263 * @param {boolean=false } deny look for deny or allow permission
6364 * @returns Ace Ace if found, else null
6465 */
65- getRight ( _id :string , deny :boolean = false ) :Ace {
66- var result :Ace = null ;
67- if ( ! this . _acl ) { this . _acl = [ ] ; }
66+ getRight ( _id : string , deny : boolean = false ) : Ace {
67+ var result : Ace = null ;
68+ if ( ! this . _acl ) { this . _acl = [ ] ; }
6869 this . _acl . forEach ( ( a , index ) => {
69- if ( a . _id === _id && a . deny === deny ) {
70+ if ( a . _id === _id && a . deny === deny ) {
7071 this . _acl [ index ] = Ace . assign ( a ) ;
7172 result = this . _acl [ index ] ;
7273 }
7374 } ) ;
74- if ( result ) {
75+ if ( result ) {
7576 result = Ace . assign ( result ) ;
7677 }
7778 return result ;
@@ -81,10 +82,10 @@ export class Base implements IBase {
8182 * @param {Ace } x
8283 * @returns void
8384 */
84- setRight ( x :Ace ) : void {
85- if ( ! this . _acl ) { this . _acl = [ ] ; }
85+ setRight ( x : Ace ) : void {
86+ if ( ! this . _acl ) { this . _acl = [ ] ; }
8687 this . _acl . forEach ( ( a , index ) => {
87- if ( a . _id === x . _id && a . deny === x . deny ) {
88+ if ( a . _id === x . _id && a . deny === x . deny ) {
8889 this . _acl [ index ] = x ;
8990 }
9091 } ) ;
@@ -97,10 +98,10 @@ export class Base implements IBase {
9798 * @param {boolean=false } deny Deny the right
9899 * @returns void
99100 */
100- addRight ( _id :string , name :string , rights :number [ ] , deny :boolean = false ) :void {
101- var right :Ace = this . getRight ( _id , deny ) ;
102- if ( ! right ) { right = new Ace ( ) ; this . _acl . push ( right ) ; }
103- right . deny = deny ; right . _id = _id ; right . name = name ;
101+ addRight ( _id : string , name : string , rights : number [ ] , deny : boolean = false ) : void {
102+ var right : Ace = this . getRight ( _id , deny ) ;
103+ if ( ! right ) { right = new Ace ( ) ; this . _acl . push ( right ) ; }
104+ right . deny = deny ; right . _id = _id ; right . name = name ;
104105 rights . forEach ( bit => {
105106 right . setBit ( bit ) ;
106107 } ) ;
@@ -113,10 +114,10 @@ export class Base implements IBase {
113114 * @param {boolean=false } deny Deny right
114115 * @returns void
115116 */
116- removeRight ( _id :string , rights :number [ ] = null , deny :boolean = false ) : void {
117- if ( ! this . _acl ) { this . _acl = [ ] ; }
118- var right :Ace = this . getRight ( _id , deny ) ;
119- if ( ! right ) { return ; }
117+ removeRight ( _id : string , rights : number [ ] = null , deny : boolean = false ) : void {
118+ if ( ! this . _acl ) { this . _acl = [ ] ; }
119+ var right : Ace = this . getRight ( _id , deny ) ;
120+ if ( ! right ) { return ; }
120121 rights . forEach ( bit => {
121122 right . unsetBit ( bit ) ;
122123 } ) ;
0 commit comments