@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,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1024.22.5",
3
+ "version": "1024.22.7",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -1 +1 @@
1
- (()=>{function e(s,t,n,o,r,i,e,u,l,a,c,g,f){var d,h=this,p=(_.assign(h,{ROUTE_NEW_USER:i.ROUTE_NEW_USER,$onInit:function(){s.all([E(),e.global.list({pageSize:1e4}).then(v)]).then(function(){return _.forEach(h.users,y)}),i.userHierarchyActive().then(function(e){h.FEATURE_USER_HIERARCHY=e}).then(U),t.$watch("vm.filters.text",function(e,n){e!==n&&(h.showSearchHint=e&&0<e.length&&e.length<3,!e||3<=e.length?p(!0):n&&3<=n.length&&p(!0,!0))})},loadMore:function(){h.users.paging.loading=!0,h.users.paging.next().then(R).finally(function(){h.users.paging.loading=!1})},loadUsers:E,loadSubusers:S,changeUser:function(s,e){var n="changeGlobalRoles"===e.name;return i.warnAboutUserLogOutIfNeeded(s,{rolesChanged:n}).then(function(){return i.changeUser(s,e)}).then(function(e){var n,t,r=s;return(e=e||{}).removeUser&&(h.users=_.reject(h.users,{id:r.id}),t=_.get(r,"_owner.id"),h.users=_.map(h.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(h.users,function(e){var n=r===e.id;return n&&(t._expanded=e._expanded),n?y(t):e});_.assign(e,_.pick(h.users,["statistics","paging"])),h.users=e})),n=e.refresh?E():n})},showExpandCollapse:function(){return h.FEATURE_USER_HIERARCHY&&_.some(h.users,function(e){return 0<e.subusersCount||_.get(e,"_owns.length")})},collapseAll:function(){i.collapseAll(h.users)},expandAll:function(){i.expandAll(h.users),s.all(_.map(h.users,function(e){return e.subusersCount>e._owns.length?S(e).then(function(){return!0}):s.resolve(!1)})).then(function(e){_.some(e)&&n(h.expandAll)})},filters:{},applyFilters:function(){E(!0)},clearFilters:function(){h.filters.globalRoles=[],E(!0)},isAnyFilterSelected:function(){return 0<_.get(h.filters,"globalRoles.length",0)},refresh:function(){return E(!0).then(function(){return _.forEach(h.users,y)})},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)};u({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(),p.cancel(),E(!0))},clearSearch:function(){h.filters.text="",p.cancel(),E(!0)}}),_.debounce(function(e,n){E(e,n),t.$applyAsync()},300));function E(e){var n=1<arguments.length&&void 0!==arguments[1]&&arguments[1];return d=e?[]:h.users,h.users=[],o.list(n?{}:(e=_.get(h.filters,"text"),n=(n=_.map(_.get(h.filters,"globalRoles"),"id")).length?n.join(","):void 0,{withSubusersCount:!0,usernameContains:e,groups:n,withApps:!1,withGroups:!1,withRoles:!1,onlyRoots:_.isEmpty(e)})).then(R)}function R(e){A(e),h.users.paging=e.paging}function A(e){var n=h.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,h.users=n}function v(e){h.globalRoles=e}function y(e){return e._globalRoles=_.map(_.get(e,"groups.references"),function(e){return _.find(h.globalRoles,{id:e.group.id})}),e}function U(){o.current().then(function(e){h.canAddUser=o.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")||h.FEATURE_USER_HIERARCHY&&o.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE"),h.canRevokeTokens=o.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")})}function S(e){return d=h.users,o.listAll({owner:e.id,withSubusersCount:!0}).then(A)}}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"})})();
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"})})();