@c8y/ng1-modules 1024.22.5 → 1024.22.7
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
(()=>{function e(s,t,n,o,r,
|
|
1
|
+
(()=>{function e(s,t,n,o,r,u,e,i,l,a,c,g,f){var d,h,p=this,E=(_.assign(p,{ROUTE_NEW_USER:u.ROUTE_NEW_USER,$onInit:function(){s.all([R(),e.global.list({pageSize:1e4}).then(y)]).then(function(){return _.forEach(p.users,U)}),u.userHierarchyActive().then(function(e){p.FEATURE_USER_HIERARCHY=e}).then(b),t.$watch("vm.filters.text",function(e,n){e!==n&&(p.showSearchHint=e&&0<e.length&&e.length<3,!e||3<=e.length?E(!0):n&&3<=n.length&&E(!0,!0))})},loadMore:function(){p.users.paging.loading=!0,p.users.paging.next().then(A).finally(function(){p.users.paging.loading=!1})},loadUsers:R,loadSubusers:S,changeUser:function(s,e){var n="changeGlobalRoles"===e.name;return u.warnAboutUserLogOutIfNeeded(s,{rolesChanged:n}).then(function(){return u.changeUser(s,e)}).then(function(e){var n,t,r=s;return(e=e||{}).removeUser&&(p.users=_.reject(p.users,{id:r.id}),t=_.get(r,"_owner.id"),p.users=_.map(p.users,function(e){return t&&t===e.id?(e.subusersCount--,angular.copy(e)):e})),e.refresh||e.removeUser||(n=o.list({username:r.id,withSubusersCount:!0}).then(_.first).then(function(t){var r=t.id,e=_.map(p.users,function(e){var n=r===e.id;return n&&(t._expanded=e._expanded),n?U(t):e});_.assign(e,_.pick(p.users,["statistics","paging"])),p.users=e})),n=e.refresh?R():n})},showExpandCollapse:function(){return p.FEATURE_USER_HIERARCHY&&_.some(p.users,function(e){return 0<e.subusersCount||_.get(e,"_owns.length")})},collapseAll:function(){u.collapseAll(p.users)},expandAll:function(){u.expandAll(p.users),s.all(_.map(p.users,function(e){return 0<e.subusersCount&&!e._subusersLoaded?S(e).then(function(){return!0}):s.resolve(!1)})).then(function(e){_.some(e)&&n(p.expandAll)})},filters:{},applyFilters:function(){R(!0)},clearFilters:function(){p.filters.globalRoles=[],R(!0)},isAnyFilterSelected:function(){return 0<_.get(p.filters,"globalRoles.length",0)},refresh:function(){return R(!0).then(function(){return _.forEach(p.users,U)})},revokeTokens:function(){function e(){return o.current().then(function(e){return t(e)}).then(function(e){return e?r.logoutAndReloadPage():s.resolve()})}var n=f.get("c8yAuthBridgeService").getPreferredLoginOption(),t=function(e){return!(!o.hasExternalOrigin(e)&&"BASIC"===n.type)};i({title:c("Confirm log out all users?"),body:g.getString('You are about to log out all users currently logged with "OAI-Secure" or "Single sign-on redirect". The JWT tokens retrieved by all devices in the current tenant will also be invalidated. Do you want to proceed?'),status:"warning",size:"sm",labels:{ok:c("Confirm")}}).then(function(){return o.revokeTokens()}).then(e).then(function(){return l.success(c("Logged out all users and invalidated tokens."))}).catch(function(e){e&&l.danger(a.getResErrorMessage(e))})},onSearchKeydown:function(e){"Enter"===e.key&&(e.preventDefault(),E.cancel(),R(!0))},clearSearch:function(){p.filters.text="",E.cancel(),R(!0)}}),_.debounce(function(e,n){R(e,n),t.$applyAsync()},300));function R(e){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1],n=(d=e?[]:p.users,p.users=[],n?{}:(e=_.get(p.filters,"text"),n=(n=_.map(_.get(p.filters,"globalRoles"),"id")).length?n.join(","):void 0,{withSubusersCount:!0,usernameContains:e,groups:n,withApps:!1,withGroups:!1,withRoles:!1,onlyRoots:_.isEmpty(e)}));return h=n.groups,o.list(n).then(A)}function A(e){v(e),p.users.paging=e.paging}function v(e){var n=p.users,t=n.paging,r=o.getTfaStrategy();_.forEach(e,function(t){var e=_.find(d,{id:t.id});t.twoFactorAuthenticationEnabled||s.all({enforced:o.isTfaActive(t),strategy:r}).then(function(e){var n=e.enforced,e=e.strategy;"SMS"!==e&&e||n&&(t.twoFactorAuthenticationEnabled=n)}),e&&(t._expanded=e._expanded),_.some(n,{id:t.id})||(n=n.concat([t]))}),n.paging=t,p.users=n}function y(e){p.globalRoles=e}function U(e){return e._globalRoles=_.map(_.get(e,"groups.references"),function(e){return _.find(p.globalRoles,{id:e.group.id})}),e}function b(){o.current().then(function(e){p.canAddUser=o.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")||p.FEATURE_USER_HIERARCHY&&o.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE"),p.canRevokeTokens=o.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")})}function S(n){return d=p.users,o.listAll({owner:n.id,groups:h,withSubusersCount:!0}).then(function(e){return n._subusersLoaded=!0,v(e)})}}e.$inject=["$q","$scope","$timeout","c8yUser","c8yUserUtil","c8yUsersUi","c8yRoles","c8yModal","c8yAlert","c8yBase","gettext","gettextCatalog","$injector"],angular.module("c8y.users").component("c8yUserListView",{templateUrl:":::PLUGIN_PATH:::/userListView/userListView.html",controller:e,controllerAs:"vm"})})();
|