Skip to content

Commit

Permalink
(js) Improve ACLs handling of inactive users
Browse files Browse the repository at this point in the history
  • Loading branch information
cgx committed Jan 26, 2017
1 parent 831c1bc commit d14b0b0
Show file tree
Hide file tree
Showing 6 changed files with 35 additions and 7 deletions.
9 changes: 9 additions & 0 deletions NEWS
Original file line number Diff line number Diff line change
@@ -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)
------------------

Expand Down
6 changes: 3 additions & 3 deletions UI/Templates/AdministrationUI/UIxAdministrationAclEditor.wox
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
6 changes: 3 additions & 3 deletions UI/Templates/UIxAclEditor.wox
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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 });
}
Expand Down
5 changes: 5 additions & 0 deletions UI/WebServerResources/js/Common/AclController.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
vm.addUser = addUser;
vm.selectAllRights = selectAllRights;
vm.selectUser = selectUser;
vm.showRights = showRights;
vm.confirmation = { showing: false,
message: ''};

Expand Down Expand Up @@ -86,6 +87,10 @@
vm.selectedUser.$rights();
}
}

function showRights(user) {
return vm.selectedUid == user.uid && user.rights;
}
}

angular
Expand Down
11 changes: 10 additions & 1 deletion UI/WebServerResources/js/Common/User.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
Expand Down

1 comment on commit d14b0b0

@thenamelessthing
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it will be better to indicate the user account is disabled. Yes now we can see the name of the account, but it's not enough. User will not understand why they can't access to the permission of the user...

Please sign in to comment.