(js) Improve ACLs handling of inactive users

pull/234/head
Francis Lachapelle 2017-01-26 12:48:21 -05:00
parent 831c1bc980
commit d14b0b0b5e
6 changed files with 35 additions and 7 deletions

9
NEWS
View File

@ -1,3 +1,12 @@
3.2.7 (2017-01-DD)
------------------
Enhancements
- [web] improved ACLs handling of inactive users
Bug fixes
- [core] fixed "include in freebusy" (reverts #3354)
3.2.6 (2017-01-23)
------------------

View File

@ -80,12 +80,12 @@
size="40">{{ user.$avatarIcon }}</sg-avatar-image>
</span>
<div class="sg-tile-content">
<div class="sg-md-subhead"><div>{{user.cn}}</div></div>
<div class="sg-md-subhead"><div>{{user.$fullname()}}</div></div>
<div class="sg-md-body"><div>{{user.c_email}}</div></div>
</div>
<md-button class="md-icon-button md-secondary" type="button"
ng-click="acl.selectAllRights(user)"
ng-hide="user.uid != acl.selectedUid || user.$isSpecial()">
ng-hide="!acl.showRights(user) || user.$isSpecial()">
<md-icon>select_all</md-icon>
</md-button>
<md-button class="md-icon-button" type="button"
@ -95,7 +95,7 @@
</md-button>
</div>
</a>
<md-card-content id="AccessRightList" ng-show="user.uid == acl.selectedUid">
<md-card-content id="AccessRightList" ng-show="acl.showRights(user)">
<var:if condition="canSubscribeUsers">
<md-checkbox ng-model="user.isSubscribed"
label:arial-label="Subscribe User"

View File

@ -57,12 +57,12 @@
size="40">{{ user.$avatarIcon }}</sg-avatar-image>
</div>
<div class="sg-tile-content">
<div class="sg-md-subhead"><div>{{user.cn}}</div></div>
<div class="sg-md-subhead"><div>{{user.$fullname()}}</div></div>
<div class="sg-md-body"><div>{{user.c_email}}</div></div>
</div>
<md-button class="md-icon-button md-secondary" type="button"
ng-click="acl.selectAllRights(user)"
ng-hide="user.uid != acl.selectedUid || user.$isSpecial()">
ng-hide="!acl.showRights(user) || user.$isSpecial()">
<md-icon>select_all</md-icon>
</md-button>
<md-button class="md-icon-button" type="button"
@ -72,7 +72,7 @@
</md-button>
</div>
</a>
<md-card-content id="AccessRightList" ng-show="user.uid == acl.selectedUid">
<md-card-content id="AccessRightList" ng-show="acl.showRights(user)">
<var:if condition="canSubscribeUsers">
<md-checkbox ng-model="user.isSubscribed"
label:arial-label="Subscribe User"

View File

@ -18,6 +18,7 @@
vm.selectedUid = null;
vm.selectUser = selectUser;
vm.selectAllRights = selectAllRights;
vm.showRights = showRights;
vm.removeUser = removeUser;
vm.getTemplate = getTemplate;
vm.close = close;
@ -56,6 +57,10 @@
}
}
function showRights(user) {
return vm.selectedUid == user.uid && user.rights;
}
function userFilter($query) {
return User.$filter($query, stateFolder.$acl.users, { dry: true, uid: vm.user.uid });
}

View File

@ -24,6 +24,7 @@
vm.addUser = addUser;
vm.selectAllRights = selectAllRights;
vm.selectUser = selectUser;
vm.showRights = showRights;
vm.confirmation = { showing: false,
message: ''};
@ -86,6 +87,10 @@
vm.selectedUser.$rights();
}
}
function showRights(user) {
return vm.selectedUid == user.uid && user.rights;
}
}
angular

View File

@ -125,13 +125,22 @@
this.empty = ' ';
};
/**
* @function $fullname
* @memberof User.prototype
* @return a string representing the fullname
*/
User.prototype.$fullname = function() {
return this.cn || this.uid;
};
/**
* @function $shortFormat
* @memberof User.prototype
* @return the fullname along with the email address
*/
User.prototype.$shortFormat = function(options) {
var fullname = this.cn || this.c_email;
var fullname = this.$fullname();
var email = this.c_email;
var no_email = options && options.email === false;
if (!no_email && email && fullname != email) {