!function(){"use strict";function e(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")}function t(e,t,r){var n;return n=_.find(r.$users,function(e){return e.uid==t.userId}),angular.isUndefined(n)?r.$filter(t.userId).then(function(s){return n=_.find(r.$users,function(e){return e.uid==t.userId}),angular.isUndefined(n)?e.reject("User with ID "+t.userId+" not found"):n.$folders().then(function(){return n})}):n}function r(e,t,r,n,s,i){var o,d,l=r(t.folderId);return o=_.find(n.$$folders,function(e){return e.name==l}),d="Appointment"==o.type?new i({id:o.name.split("/").pop(),owner:o.owner,name:o.displayName}):new s({id:o.name.split("/").pop(),owner:o.owner,name:o.displayName}),n.selectedFolder=d.id,d}function n(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";function e(e,t,r,n,s,i,o){function d(){return angular.isDefined(i.$cards)?"../"+i.owner+"/Contacts/"+i.id+"/UIxContactsUserRightsEditor":"../"+i.owner+"/Calendar/"+i.id+"/UIxCalUserRightsEditor"}function a(e){i.$acl.$selectAllRights(e)}function u(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())}function c(e){return g.selectedUid==e.uid&&e.rights}function f(e){return o.$filter(e,i.$acl.users,{dry:!0,uid:g.user.uid})}function m(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)})}function U(){t.go("administration.rights").then(function(){delete g.user.selectedFolder,g.user=null})}function h(){i.$acl.$saveUsersRights(i.owner).then(function(){n.show(n.simple().content(l("ACLs saved")).position("bottom right").hideDelay(3e3)),r("xs")&&U()})}var g=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";function e(e,t,r,n,s,i,o,d){function l(t){e.go("administration."+t),r(s["gt-md"])||n("left").close()}function a(e){d.$filter(e)}function u(e){f.selectedUser==f.users[e]?f.selectedUser=null:f.users[e].$folders().then(function(){f.selectedUser=f.users[e]})}function c(t){e.go("administration.rights.edit",{userId:f.selectedUser.uid,folderId:o(t.name)})}var f=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)}();
//# sourceMappingURL=Administration.js.map