@@ -842,7 +842,7 @@ module openflow {
842842 } ) ;
843843 }
844844 async loadUsers ( ) : Promise < void > {
845- this . allusers = await this . api . Query ( this . collection , { $or : [ { _type : "user" } , { _type : "role" } ] } , null , { _type : - 1 , name : 1 } ) ;
845+ this . allusers = await this . api . Query ( "users" , { $or : [ { _type : "user" } , { _type : "role" } ] } , null , { _type : - 1 , name : 1 } ) ;
846846 if ( this . model . members === undefined ) { this . model . members = [ ] ; }
847847 var ids : string [ ] = [ ] ;
848848 for ( var i : number = 0 ; i < this . model . members . length ; i ++ ) {
@@ -1480,6 +1480,7 @@ module openflow {
14801480 public jsonmodel : string = "" ;
14811481 public newuser : openflow . TokenUser ;
14821482 public usergroups : openflow . TokenUser [ ] = [ ] ;
1483+ public allusergroups : openflow . TokenUser [ ] = [ ] ;
14831484 constructor (
14841485 public $scope : ng . IScope ,
14851486 public $location : ng . ILocationService ,
@@ -1493,7 +1494,8 @@ module openflow {
14931494 this . collection = $routeParams . collection ;
14941495 this . postloadData = this . processdata ;
14951496 WebSocketClient . onSignedin ( async ( user : TokenUser ) => {
1496- this . usergroups = await this . api . Query ( "users" , { } ) ;
1497+ // this.usergroups = await this.api.Query("users", {});
1498+ this . allusergroups = await this . api . Query ( "users" , { $or : [ { _type : "user" } , { _type : "role" } ] } , null , { _type : - 1 , name : 1 } ) ;
14971499 if ( this . id !== null && this . id !== undefined ) {
14981500 await this . loadData ( ) ;
14991501 } else {
@@ -1509,26 +1511,12 @@ module openflow {
15091511 } ) ;
15101512 }
15111513 processdata ( ) {
1512- // $(document)
1513- // .one('focus.autoExpand', 'textarea.autoExpand', function () {
1514- // var savedValue = this.value;
1515- // this.value = '';
1516- // this.baseScrollHeight = this.scrollHeight;
1517- // this.value = savedValue;
1518-
1519- // var minRows = this.getAttribute('data-min-rows') | 0, rows;
1520- // this.rows = minRows;
1521- // rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16);
1522- // this.rows = minRows + rows;
1523- // })
1524- // .on('input.autoExpand', 'textarea.autoExpand', function () {
1525- // var minRows = this.getAttribute('data-min-rows') | 0, rows;
1526- // // this.rows = minRows;
1527- // rows = Math.ceil((this.scrollHeight - this.baseScrollHeight) / 16);
1528- // if (this.rows < (minRows + rows)) {
1529- // this.rows = minRows + rows;
1530- // }
1531- // });
1514+ var ids : string [ ] = [ ] ;
1515+ for ( var i : number = 0 ; i < this . model . _acl . length ; i ++ ) {
1516+ ids . push ( this . model . _acl [ i ] . _id ) ;
1517+ }
1518+ this . usergroups = this . allusergroups . filter ( x => ids . indexOf ( x . _id ) == - 1 ) ;
1519+ this . newuser = this . usergroups [ 0 ] ;
15321520 if ( ! this . $scope . $$phase ) { this . $scope . $apply ( ) ; }
15331521 }
15341522 togglejson ( ) {
@@ -1576,6 +1564,13 @@ module openflow {
15761564 //this.model._acl = this.model._acl.splice(index, 1);
15771565 }
15781566 }
1567+ var ids : string [ ] = [ ] ;
1568+ for ( var i : number = 0 ; i < this . model . _acl . length ; i ++ ) {
1569+ ids . push ( this . model . _acl [ i ] . _id ) ;
1570+ }
1571+ this . usergroups = this . allusergroups . filter ( x => ids . indexOf ( x . _id ) == - 1 ) ;
1572+ this . newuser = this . usergroups [ 0 ] ;
1573+
15791574 }
15801575 adduser ( ) {
15811576 var ace = new Ace ( ) ;
@@ -1584,6 +1579,13 @@ module openflow {
15841579 ace . name = this . newuser . name ;
15851580 ace . rights = "//////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////8=" ;
15861581 this . model . _acl . push ( ace ) ;
1582+ var ids : string [ ] = [ ] ;
1583+ for ( var i : number = 0 ; i < this . model . _acl . length ; i ++ ) {
1584+ ids . push ( this . model . _acl [ i ] . _id ) ;
1585+ }
1586+ this . usergroups = this . allusergroups . filter ( x => ids . indexOf ( x . _id ) == - 1 ) ;
1587+ this . newuser = this . usergroups [ 0 ] ;
1588+
15871589 }
15881590 isBitSet ( base64 : string , bit : number ) : boolean {
15891591 bit -- ;
0 commit comments