!function(){"use strict";functione(e,n){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:t,stateFolder:r}}),n.otherwise("/rights")}functiont(e,t,r){varn;returnn=_.find(r.$users,function(e){returne.uid==t.userId}),angular.isUndefined(n)?r.$filter(t.userId).then(function(s){returnn=_.find(r.$users,function(e){returne.uid==t.userId}),angular.isUndefined(n)?e.reject("User with ID "+t.userId+" not found"):n.$folders().then(function(){returnn})}):n}functionr(e,t,r,n,s,i){varo,d,l=r(t.folderId);returno=_.find(n.$$folders,function(e){returne.name==l}),d="Appointment"==o.type?newi({id:o.name.split("/").pop(),owner:o.owner,name:o.displayName}):news({id:o.name.split("/").pop(),owner:o.owner,name:o.displayName}),n.selectedFolder=d.id,d}functionn(e,t,r){t.$on("$stateChangeError",function(t,n,s,i,o,d){e.error(d),r.go("administration.rights")}),t.$on("$routeChangeError",function(t,r,n,s){e.error(t,r,n,s)})}angular.module("SOGo.AdministrationUI",["ui.router","SOGo.Common","SOGo.Authentication","SOGo.PreferencesUI","SOGo.ContactsUI","SOGo.SchedulerUI"]).config(e).run(n),e.$inject=["$stateProvider","$urlRouterProvider"],t.$inject=["$q","$stateParams","User"],r.$inject=["$state","$stateParams","decodeUriFilter","stateUser","AddressBook","Calendar"],n.$inject=["$log","$rootScope","$state"]}(),function(){"use strict";functione(e,t,r,n,s,i,o){functiond(){returnangular.isDefined(i.$cards)?"../"+i.owner+"/Contacts/"+i.id+"/UIxContactsUserRightsEditor":"../"+i.owner+"/Calendar/"+i.id+"/UIxCalUserRightsEditor"}functiona(e){i.$acl.$selectAllRights(e)}functionu(e,t){if(t&&t.target.parentNode.classList.contains("md-secondary"))return!1;g.selectedUid==e.uid?g.selectedUid=null:(g.selectedUid=e.uid,g.selectedUser=e,g.selectedUser.$rights())}functionc(e){returng.selectedUid==e.uid&&e.rights}functionf(e){returno.$filter(e,i.$acl.users,{dry:!0,uid:g.user.uid})}functionm(t){e(function(){i.$acl.$removeUser(t.uid,i.owner)},500)}function$(e){e&&i.$acl.$addUser(e,i.owner).then(function(e){g.userToAdd="",g.searchText="",g.selectedUid=null,e&&u(e)})}functionU(){t.go("administration.rights").then(function(){deleteg.user.selectedFolder,g.user=null})}functionh(){i.$acl.$saveUsersRights(i.owner).then(function(){n.show(n.simple().content(l("ACLs saved")).position("bottom right").hideDelay(3e3)),r("xs")&&U()})}varg=this;g.user=s,g.folder=i,g.folderType=angular.isDefined(i.$cards)?"AddressBook":"Calendar",g.selectedUser=null,g.selectedUid=null,g.selectUser=u,g.selectAllRights=a,g.showRights=c,g.removeUser=m,g.getTemplate=d,g.close=U,g.save=h,g.userToAdd="",g.searchText="",g.userFilter=f,g.addUser=$,i.$acl.$users(i.owner).then(function(e){g.users=e})}e.$inject=["$timeout","$state","$mdMedia","$mdToast","stateUser","stateFolder","User"],angular.module("SOGo.AdministrationUI").controller("AdministrationAclController",e)}(),function(){"use strict";functione(e,t,r,n,s,i,o,d){functionl(t){e.go("administration."+t),r(s["gt-md"])||n("left").close()}functiona(e){d.$filter(e)}functionu(e){f.selectedUser==f.users[e]?f.selectedUser=null:f.users[e].$folders().then(function(){f.selectedUser=f.users[e]})}functionc(t){e.go("administration.rights.edit",{userId:f.selectedUser.uid,folderId:o(t.name)})}varf=this;f.service=d,f.selectedUser=null,f.users=d.$users,f.go=l,f.filter=a,f.selectUser=u,f.selectFolder=c}e.$inject=["$state","$mdToast","$mdMedia","$mdSidenav","sgConstant","Dialog","encodeUriFilter","User"],angular.module("SOGo.AdministrationUI").controller("AdministrationController",e)}();