!function(){"use strict";function e(e,t){e.state("administration",{abstract:!0,views:{administration:{templateUrl:"administration.html",controller:"AdministrationController",controllerAs:"app"}}}).state("administration.rights",{url:"/rights",views:{module:{templateUrl:"rights.html"}}}).state("administration.rights.edit",{url:"/:userId/:folderId/edit",views:{acl:{templateUrl:"UIxAdministrationAclEditor",controller:"AdministrationAclController",controllerAs:"acl"}},resolve:{stateUser:r,stateFolder:n}}),t.rules.otherwise("/rights")}function r(t,r,n){var i;return i=_.find(n.$users,function(e){return e.uid==r.userId}),angular.isUndefined(i)?n.$filter(r.userId).then(function(e){return i=_.find(n.$users,function(e){return e.uid==r.userId}),angular.isUndefined(i)?t.reject("User with ID "+r.userId+" not found"):i.$folders().then(function(){return i})}):i}function n(e,t,r,n,i,s){var o,d,l=r(t.folderId);return d="Appointment"==(o=_.find(n.$$folders,function(e){return e.name==l})).type?new s({id:o.name.split("/").pop(),owner:o.owner,name:o.displayName}):new i({id:o.name.split("/").pop(),owner:o.owner,name:o.displayName}),n.selectedFolder=d.id,d}function t(e,t,r,n){e.DebugEnabled||n.defaultErrorHandler(function(){}),r.onError({to:"administration.**"},function(e){"administration"==e.to().name||e.ignored()||(t.error("transition error to "+e.to().name+": "+e.error().detail),n.go({state:"administration.rights"}))})}angular.module("SOGo.AdministrationUI",["ui.router","SOGo.Common","SOGo.Authentication","SOGo.PreferencesUI","SOGo.ContactsUI","SOGo.SchedulerUI"]).config(e).run(t),e.$inject=["$stateProvider","$urlServiceProvider"],r.$inject=["$q","$stateParams","User"],n.$inject=["$state","$stateParams","decodeUriFilter","stateUser","AddressBook","Calendar"],t.$inject=["$window","$log","$transitions","$state"]}(),function(){"use strict";function e(t,e,r,n,i,s,o){var d=this;function a(e,t){if(t&&t.target.parentNode.classList.contains("md-secondary"))return!1;d.selectedUid==e.uid?d.selectedUid=null:(d.selectedUid=e.uid,d.selectedUser=e,d.selectedUser.$rights())}function u(){e.go("administration.rights").then(function(){delete d.user.selectedFolder,d.user=null})}d.user=i,d.folder=s,d.folderType=angular.isDefined(s.$cards)?"AddressBook":"Calendar",d.selectedUser=null,d.selectedUid=null,d.selectUser=a,d.selectAllRights=function(e){s.$acl.$selectAllRights(e)},d.showRights=function(e){return d.selectedUid==e.uid&&e.rights},d.removeUser=function(e){t(function(){s.$acl.$removeUser(e.uid,s.owner)},500)},d.getTemplate=function(){return angular.isDefined(s.$cards)?"../"+s.owner+"/Contacts/"+s.id+"/UIxContactsUserRightsEditor":"../"+s.owner+"/Calendar/"+s.id+"/UIxCalUserRightsEditor"},d.close=u,d.save=function(){s.$acl.$saveUsersRights(s.owner).then(function(){n.show(n.simple().content(l("ACLs saved")).position("bottom right").hideDelay(3e3)),r("xs")&&u()})},d.userToAdd="",d.searchText="",d.userFilter=function(e){return o.$filter(e,s.$acl.users,{dry:!0,uid:d.user.uid})},d.addUser=function(e){e&&s.$acl.$addUser(e,s.owner).then(function(e){d.userToAdd="",d.searchText="",d.selectedUid=null,e&&a(e)})},s.$acl.$users(s.owner).then(function(e){d.users=e})}e.$inject=["$timeout","$state","$mdMedia","$mdToast","stateUser","stateFolder","User"],angular.module("SOGo.AdministrationUI").controller("AdministrationAclController",e)}(),function(){"use strict";function e(t,e,r,n,i,s,o,d){var l=this;l.service=d,l.selectedUser=null,l.users=d.$users,l.go=function(e){t.go("administration."+e),r(i["gt-md"])||n("left").close()},l.filter=function(e){d.$filter(e)},l.selectUser=function(e){l.selectedUser==l.users[e]?l.selectedUser=null:l.users[e].$folders().then(function(){l.selectedUser=l.users[e]})},l.selectFolder=function(e){t.go("administration.rights.edit",{userId:l.selectedUser.uid,folderId:o(e.name)})}}e.$inject=["$state","$mdToast","$mdMedia","$mdSidenav","sgConstant","Dialog","encodeUriFilter","User"],angular.module("SOGo.AdministrationUI").controller("AdministrationController",e)}();
//# sourceMappingURL=Administration.js.map