Move ACL editor into a separate template

The user rights remain dynamic, based on the object type (addressbook vs
mailbox vs calendar).
This commit is contained in:
Francis Lachapelle
2014-11-03 15:58:54 -05:00
parent 97ce3e6b72
commit c063832d0d
5 changed files with 122 additions and 151 deletions
@@ -38,7 +38,8 @@
$timeout: $timeout,
$$resource: new Resource(Settings.baseURL),
$Card: Card,
$$Acl: Acl
$$Acl: Acl,
activeUser: Settings.activeUser
});
return AddressBook; // return constructor
@@ -77,6 +78,9 @@
// Instanciate AddressBook objects
angular.forEach(this.$addressbooks, function(o, i) {
_this.$addressbooks[i] = new AddressBook(o);
// Add 'isOwned' attribute based on active user (TODO: add it server-side?)
_this.$addressbooks[i].isOwned = _this.activeUser.isSuperUser
|| _this.$addressbooks[i].owner == _this.activeUser.login;
});
}
return this.$addressbooks;
+8 -2
View File
@@ -9,7 +9,13 @@
angular.module('SOGo.ContactsUI', ['ngSanitize', 'ui.router', 'mm.foundation', 'SOGo.Common', 'SOGo.UIDesktop'])
.constant('sgSettings', {
baseURL: ApplicationBaseURL
baseURL: ApplicationBaseURL,
activeUser: {
login: UserLogin,
language: UserLanguage,
folderURL: UserFolderURL,
isSuperUser: IsSuperUser
}
})
.config(['$stateProvider', '$urlRouterProvider', function($stateProvider, $urlRouterProvider) {
@@ -181,7 +187,7 @@
};
$scope.share = function() {
var modal = $modal.open({
templateUrl: 'addressbookSharing.html',
templateUrl: stateAddressbook.id + '/aclsTemplate',
resolve: {
modalUsers: function() {
return stateAddressbook.$acl.$users();