@c8y/ng1-modules 1018.504.16 → 1018.505.4

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.
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(u,r,o,e,a){var t,n="tenant/",l="".concat(n,"tenants"),i="".concat(n,"currentTenant"),c="management",p=["applications","ownedApplications","adminName"],s=["allowCreateTenants"],f=["adminPass"],y=o.cleanFields;return{list:function e(t){t=o.pageSizeFilter(_objectSpread(_objectSpread({},t),{},{pageSize:1e3,currentPage:_.get(t,"currentPage")}));var n={params:t};var r=o.url(l);t=o.cleanListCallback("tenants",e,t);return u.get(r,n).then(t)},save:function(e){var e=_.cloneDeep(e),n=!e.applications,t=n?"post":"put",a=e.allowCreateTenants;e.adminPass||(e=y(e,f));e=y(e,n?s:p);var i=o.url(l)+(n?"":"/".concat(e.id)),c={headers:o.contentHeaders("tenant",!0)};return e=y(e,["id"]),r.resolve(e).then(function(e){return u[t](i,e,c)}).then(function(e){var t=r.resolve(e);return t=n&&a?t.then(function(e){var t=e,n=i,r=c,o=a;return t=e.data.id,n="".concat(n,"/").concat(t),u.put(n,{allowCreateTenants:o},r)}).then(function(){return e}):t})},remove:function(e){e=b(e);return u.delete(e)},detail:function(e){e=b(e);return u.get(e)},addApplication:function(e,t,n){var r=t.id||t,e=d(e),r={application:{id:r,self:t.self}},t=_objectSpread({headers:o.contentHeaders("applicationReference",!0)},n);return u.post(e,r,t)},removeApplication:function(e,t,n){t=t.id||t,e="".concat(d(e),"/").concat(t);return u.delete(e,n)},isCurrentUserTopTenant:function(){return e.current().then(function(e){return m(e.tenant)})},isParentTopTenant:function(e){return m(e.parent)},isTopTenant:m,current:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];t&&!e||(t=u.get(o.url(i),{silentError:!0}).then(o.getResData,function(e){return 404===e.status?r.when({allowsCreateSubtenant:!0}):r.reject(e)}));return t},isEnterpriseEditionTenant:function(){var t={name:"feature-branding"},n=[{name:"sslmanagement"},{name:"feature-user-hierarchy"},{name:"feature-broker"}];return a.areAllAvailable([{name:"branding"}].concat(n)).then(function(e){return e||a.areAllAvailable([t].concat(n))})},isSubscribed:function(t){return this.current().then(function(e){return _.get(e,"applications.references",[]).map(function(e){return e.application})}).then(function(e){return a.isAppOnTheList(e,t)})}};function b(e){e=e.id||e;return o.url("".concat(l,"/").concat(e))}function d(e){return"".concat(b(e),"/applications")}function m(e){return e===c}}e.$inject=["$http","$q","c8yBase","c8yUser","c8yApplication"],angular.module("c8y.core").factory("c8yTenant",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(t,e){var n,r=Object.keys(t);return Object.getOwnPropertySymbols&&(n=Object.getOwnPropertySymbols(t),e&&(n=n.filter(function(e){return Object.getOwnPropertyDescriptor(t,e).enumerable})),r.push.apply(r,n)),r}function _objectSpread(t){for(var e=1;e<arguments.length;e++){var n=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(n),!0).forEach(function(e){_defineProperty(t,e,n[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(t,Object.getOwnPropertyDescriptors(n)):ownKeys(Object(n)).forEach(function(e){Object.defineProperty(t,e,Object.getOwnPropertyDescriptor(n,e))})}return t}function _defineProperty(e,t,n){return(t=_toPropertyKey(t))in e?Object.defineProperty(e,t,{value:n,enumerable:!0,configurable:!0,writable:!0}):e[t]=n,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,t){if("object"!==_typeof(e)||null===e)return e;var n=e[Symbol.toPrimitive];if(void 0===n)return("string"===t?String:Number)(e);n=n.call(e,t||"default");if("object"!==_typeof(n))return n;throw new TypeError("@@toPrimitive must return a primitive value.")}!function(){function e(u,r,o,e,a){var t,n="tenant/",l="".concat(n,"tenants"),i="".concat(n,"currentTenant"),c="management",p=["applications","ownedApplications","adminName","adminEmail"],s=["allowCreateTenants"],f=["adminPass"],y=o.cleanFields;return{list:function e(t){t=o.pageSizeFilter(_objectSpread(_objectSpread({},t),{},{pageSize:1e3,currentPage:_.get(t,"currentPage")}));var n={params:t};var r=o.url(l);t=o.cleanListCallback("tenants",e,t);return u.get(r,n).then(t)},save:function(e){var e=_.cloneDeep(e),n=!e.applications,t=n?"post":"put",a=e.allowCreateTenants;e.adminPass||(e=y(e,f));e=y(e,n?s:p);var i=o.url(l)+(n?"":"/".concat(e.id)),c={headers:o.contentHeaders("tenant",!0)};return e=y(e,["id"]),r.resolve(e).then(function(e){return u[t](i,e,c)}).then(function(e){var t=r.resolve(e);return t=n&&a?t.then(function(e){var t=e,n=i,r=c,o=a;return t=e.data.id,n="".concat(n,"/").concat(t),u.put(n,{allowCreateTenants:o},r)}).then(function(){return e}):t})},remove:function(e){e=b(e);return u.delete(e)},detail:function(e){e=b(e);return u.get(e)},addApplication:function(e,t,n){var r=t.id||t,e=d(e),r={application:{id:r,self:t.self}},t=_objectSpread({headers:o.contentHeaders("applicationReference",!0)},n);return u.post(e,r,t)},removeApplication:function(e,t,n){t=t.id||t,e="".concat(d(e),"/").concat(t);return u.delete(e,n)},isCurrentUserTopTenant:function(){return e.current().then(function(e){return m(e.tenant)})},isParentTopTenant:function(e){return m(e.parent)},isTopTenant:m,current:function(){var e=0<arguments.length&&void 0!==arguments[0]&&arguments[0];t&&!e||(t=u.get(o.url(i),{silentError:!0}).then(o.getResData,function(e){return 404===e.status?r.when({allowsCreateSubtenant:!0}):r.reject(e)}));return t},isEnterpriseEditionTenant:function(){var t={name:"feature-branding"},n=[{name:"sslmanagement"},{name:"feature-user-hierarchy"},{name:"feature-broker"}];return a.areAllAvailable([{name:"branding"}].concat(n)).then(function(e){return e||a.areAllAvailable([t].concat(n))})},isSubscribed:function(t){return this.current().then(function(e){return _.get(e,"applications.references",[]).map(function(e){return e.application})}).then(function(e){return a.isAppOnTheList(e,t)})}};function b(e){e=e.id||e;return o.url("".concat(l,"/").concat(e))}function d(e){return"".concat(b(e),"/applications")}function m(e){return e===c}}e.$inject=["$http","$q","c8yBase","c8yUser","c8yApplication"],angular.module("c8y.core").factory("c8yTenant",e)}();
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function _objectSpread(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function _defineProperty(e,n,t){return(n=_toPropertyKey(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,n){if("object"!==_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===n?String:Number)(e);t=t.call(e,n||"default");if("object"!==_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,n){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}!function(){function e(c,s,t,f,o,e,r){var n="user/{tenant}/users",u="user/currentUser",i=null,l={headers:f.contentHeaders("user",!0)},a={headers:f.contentHeaders("user",!0)};function d(e,n){return e.replace(/\{tenant\}/g,n)}function p(e){e=_.cloneDeep(e);return e.id&&delete e.userName,delete e.id,delete e.self,delete e.effectiveRoles,e}function h(e){var n=e.id||e;return g().then(function(e){return"".concat(e,"/").concat(encodeURIComponent(n))})}function y(){return s.when(f.url(u))}function g(){return m().then(function(e){return f.url(d(n,e.tenant))})}function v(e){e=e.match(/\/user\/([\w-]+)\//);if(e.length<2)throw new Error("Cannot find tenant on user self URL");return e[1]}function m(e){var n=u,t=_.cloneDeep(a);return(i=e?null:i)&&!_.isFunction(i.then)?s.when(i):i=i||c.get(f.url(n),t).then(function(e){return(i=e.data).tenant=v(i.self),i},function(){return i=null,s.reject()})}function b(e){var e=f.pageSizeFilter(e),n={params:e},t=f.cleanListCallback("users",b,e);return g().then(function(e){return c.get(e,n).then(t)})}function w(e,n){var t={silentError:n};return h(e).then(function(e){return c.get(e,t)})}function S(){var e=f.url(u),n=_.cloneDeep(a);return c.get(e,n)}function T(r,o){var u=o,i=p(r),n=_.cloneDeep(l),a=u?y():h(r);return a.then(function(e){return c.put(e,i,n)}).then(function(e){var n=s.resolve(e),t=e.data;return!_.isUndefined(i.password)&&u&&(i.id=t.id,n=n.then(function(){return s.when(A(i))})),_.isUndefined(r.owner)||r.owner===t.owner||(n=n.then(null===r.owner?function(){return h(e=t).then(function(e){return c.delete("".concat(e,"/owner"))}).then(function(){return w(e)});var e}:function(){return e=a,n={owner:r.owner},t={"Content-Type":f.mimeType("userOwnerReference")},e.then(function(e){return"".concat(e,"/owner")}).then(function(e){return c.put(e,n,{headers:t})});var e,n,t})),n=(n=_.isUndefined(r.delegatedBy)||r.delegatedBy===t.delegatedBy?n:n.then(null===r.delegatedBy?function(){return h(e=t).then(function(e){return c.delete("".concat(e,"/delegatedby"))}).then(function(){return w(e)});var e}:function(){return e=a,n={delegatedBy:r.delegatedBy},t={"Content-Type":f.mimeType("userDelegatedByReference")},e.then(function(e){return"".concat(e,"/delegatedby")}).then(function(e){return c.put(e,n,{headers:t})});var e,n,t})).then(function(){return o?S():w(r)})}).then(function(e){return t.$emit("c8yUser:update",{user:e.data,res:e}),e})}function P(e,n){var t,r;return e.id?T(e,n):(t=p(e),r=_.cloneDeep(l),g().then(function(e){return c.post(e,t,r)}))}function A(n){return O(n).then(function(e){return e?o.updatePassword(n.password||o.getPassword()):s.resolve()})}function O(e){var n=e.id||e;return m().then(function(e){return s.when(e.id===n)})}function j(e){return _.get(e,"groups.references",[]).map(function(e){return e.group})}function U(e){var n=o.headers();return e&&(n.Authorization="Basic ".concat(e)),_.assign(n,f.contentHeaders("user",!0))}function k(){return m().then(function(e){return E(e)}).then(function(e){return e.enabledOnSystemLevel||e.enabledOnTenantLevel})}function E(e,n){n=n||v(e.self);return r.getTfaSettings(n)}function I(e,n){e=_.some(j(e),function(e){return e.name===n.enforcedUsersGroup});return n.enforcedOnSystemLevel||n.totpEnforcedOnTenantLevel||e}function C(e){return"".concat(e,"/roles/inventory")}return t.$on("authStateChange",function(e,n){n.hasAuth||(i=null)}),{current:m,getCurrentUser:function(){return i},checkIfCurrent:O,listAll:function(e){function r(e){o.push.apply(o,_toConsumableArray(e));var n=e.statistics.pageSize,t=e.paging.next,n=e.length>=n;return t=t&&n?e.paging.next().then(r):s.resolve(o)}var o=[];return b(_objectSpread({pageSize:f.MAX_PAGESIZE},e)).then(r)},list:b,detail:w,detailCurrent:S,remove:function(e){return h(e).then(function(e){return c.delete(e)})},enable:function(e){return P({id:e.id||e,enabled:!0})},disable:function(e){return P({id:e.id||e,enabled:!1})},save:P,saveCurrent:function(e){return P(e,!0)},savePhoneNumber:function(e,n){var t=f.url("user/currentUserPhone"),e={headers:U(o.encodeToken(e.name,e.password,e.tenant)),method:"PUT",url:t,data:{phone:n},silentError:!0};return c(e)},groups:j,isDeviceUser:function(e){return e.id.match(/^device_/)},isServiceUser:function(e){var n;return n=(e.id||e).match(/^service_/)?!0:n},hasRole:function(e,n){return function(e,n){var t=!1,e=_.get(e,"roles.references");e&&_.forEach(e,function(e){e.role.id===n&&(t=!0)});return t}(e,n)||function(e,n){var t=!1,e=_.get(e,"groups.references");e&&_.forEach(e,function(e){_.forEach(e.group.roles.references,function(e){e.role.id===n&&(t=!0)})});return t}(e,n)},getDevicePermissions:function(e,n){var t={params:f.pageSizeFilter({moId:n})};return h(e).then(function(e){return c.get("".concat(e,"/devicePermissions"),t)})},login:function(e,n,t,r){return n=o.encodeToken(n,t,e),o.setAuthToken(n).then(function(){return o.saveAuthToken(r)})},logout:function(){return o.logout()},revokeTokens:function(){return m().then(function(e){return f.url(d("user/logout/{tenant}/allUsers",e.tenant))}).then(function(e){return c.post(e)})},isAdmin:function(e){return _.some(e.groups.references,function(e){return"admins"===e.group.name})},changePassword:function(i,e,n){var a={newPassword:e,currentUserPassword:n};return O(i).then(function(e){return e?(r=i,o=a,u={"content-type":"application/json"},y().then(function(e){return c.put("".concat(e,"/password"),o,{headers:u})}).then(function(){return A(r)})):(n=a,t={"content-type":"application/json"},h(i).then(function(e){return c.put("".concat(e,"/password"),n,{headers:t})}));var n,t,r,o,u})},isCurrentPassword:function(e){return o.getPassword()===e},isTfaAvailable:k,isTfaActive:function(t){return _.isUndefined(t.id)?k():s.when(t).then(function(e){var n=e.twoFactorAuthenticationEnabled;return E(t).then(function(e){return"TOTP"!==e.strategy&&!!I(t,e)||n})})},getTenantTfaSettings:E,isEnforcedForUser:I,getTfaStrategy:function(){return e.detailValue({category:"two-factor-authentication",key:"strategy"},"SMS")},getHeaders:U,activateSupportUser:function(){var e=f.url("tenant/support-user/enable");return c.put(e)},deactivateSupportUser:function(){var e=f.url("tenant/support-user/disable");return c.put(e)},delegateTo:function(e){var n={id:e.id};return m().then(function(e){return n.delegatedBy=e.id,T(n)})},setUserTfaSettings:function(e,n){var t={"content-type":"application/json"};return h(e.id||e.userName).then(function(e){e="".concat(e,"/tfa");return c.put(e,n,{headers:t})})},getUserTfaSettings:function(e){return h(e).then(function(e){e="".concat(e,"/tfa");return c.get(e)})},hasExternalOrigin:function(e){return e.customProperties&&"OAUTH2"===e.customProperties.userOrigin},listInventoryRoles:function(e){return(e?s.resolve(e):m()).then(h).then(C).then(function(e){return c.get(e)})},assignInventoryRoles:function(e,n,t){var e=e?s.resolve(e):m(),r={managedObject:n,roles:_.map(t,function(e){return _.pick(e,"id")})};return e.then(h).then(C).then(function(e){return c.post(e,r)})},updateInventoryRoles:function(e,n,t){var e=e?s.resolve(e):m(),r={roles:_.map(t,function(e){return _.pick(e,"id")})};return e.then(h).then(C).then(function(e){return c.put("".concat(e,"/").concat(n),r)})},removeInventoryRoles:function(e,n){return(e?s.resolve(e):m()).then(h).then(C).then(function(e){return c.delete("".concat(e,"/").concat(n))})}}}e.$inject=["$http","$q","$rootScope","c8yBase","c8yAuth","c8ySettings","c8yTfaSettings"],angular.module("c8y.core").factory("c8yUser",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}function ownKeys(n,e){var t,r=Object.keys(n);return Object.getOwnPropertySymbols&&(t=Object.getOwnPropertySymbols(n),e&&(t=t.filter(function(e){return Object.getOwnPropertyDescriptor(n,e).enumerable})),r.push.apply(r,t)),r}function _objectSpread(n){for(var e=1;e<arguments.length;e++){var t=null!=arguments[e]?arguments[e]:{};e%2?ownKeys(Object(t),!0).forEach(function(e){_defineProperty(n,e,t[e])}):Object.getOwnPropertyDescriptors?Object.defineProperties(n,Object.getOwnPropertyDescriptors(t)):ownKeys(Object(t)).forEach(function(e){Object.defineProperty(n,e,Object.getOwnPropertyDescriptor(t,e))})}return n}function _defineProperty(e,n,t){return(n=_toPropertyKey(n))in e?Object.defineProperty(e,n,{value:t,enumerable:!0,configurable:!0,writable:!0}):e[n]=t,e}function _toPropertyKey(e){e=_toPrimitive(e,"string");return"symbol"===_typeof(e)?e:String(e)}function _toPrimitive(e,n){if("object"!==_typeof(e)||null===e)return e;var t=e[Symbol.toPrimitive];if(void 0===t)return("string"===n?String:Number)(e);t=t.call(e,n||"default");if("object"!==_typeof(t))return t;throw new TypeError("@@toPrimitive must return a primitive value.")}function _toConsumableArray(e){return _arrayWithoutHoles(e)||_iterableToArray(e)||_unsupportedIterableToArray(e)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(e,n){var t;if(e)return"string"==typeof e?_arrayLikeToArray(e,n):"Map"===(t="Object"===(t=Object.prototype.toString.call(e).slice(8,-1))&&e.constructor?e.constructor.name:t)||"Set"===t?Array.from(e):"Arguments"===t||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(t)?_arrayLikeToArray(e,n):void 0}function _iterableToArray(e){if("undefined"!=typeof Symbol&&null!=e[Symbol.iterator]||null!=e["@@iterator"])return Array.from(e)}function _arrayWithoutHoles(e){if(Array.isArray(e))return _arrayLikeToArray(e)}function _arrayLikeToArray(e,n){(null==n||n>e.length)&&(n=e.length);for(var t=0,r=new Array(n);t<n;t++)r[t]=e[t];return r}!function(){function e(c,s,t,f,o,e,r){var n="user/{tenant}/users",u="user/currentUser",i=null,l={headers:f.contentHeaders("user",!0)},a={headers:f.contentHeaders("user",!0)};function d(e,n){return e.replace(/\{tenant\}/g,n)}function p(e,n){e=_.cloneDeep(e);return e.id&&delete e.userName,n&&delete e.email,delete e.id,delete e.self,delete e.effectiveRoles,e}function h(e){var n=e.id||e;return g().then(function(e){return"".concat(e,"/").concat(encodeURIComponent(n))})}function y(){return s.when(f.url(u))}function g(){return m().then(function(e){return f.url(d(n,e.tenant))})}function v(e){e=e.match(/\/user\/([\w-]+)\//);if(e.length<2)throw new Error("Cannot find tenant on user self URL");return e[1]}function m(e){var n=u,t=_.cloneDeep(a);return(i=e?null:i)&&!_.isFunction(i.then)?s.when(i):i=i||c.get(f.url(n),t).then(function(e){return(i=e.data).tenant=v(i.self),i},function(){return i=null,s.reject()})}function b(e){var e=f.pageSizeFilter(e),n={params:e},t=f.cleanListCallback("users",b,e);return g().then(function(e){return c.get(e,n).then(t)})}function w(e,n){var t={silentError:n};return h(e).then(function(e){return c.get(e,t)})}function S(){var e=f.url(u),n=_.cloneDeep(a);return c.get(e,n)}function T(r,o){var u=o,i=p(r,!u),n=_.cloneDeep(l),a=u?y():h(r);return a.then(function(e){return c.put(e,i,n)}).then(function(e){var n=s.resolve(e),t=e.data;return!_.isUndefined(i.password)&&u&&(i.id=t.id,n=n.then(function(){return s.when(A(i))})),_.isUndefined(r.owner)||r.owner===t.owner||(n=n.then(null===r.owner?function(){return h(e=t).then(function(e){return c.delete("".concat(e,"/owner"))}).then(function(){return w(e)});var e}:function(){return e=a,n={owner:r.owner},t={"Content-Type":f.mimeType("userOwnerReference")},e.then(function(e){return"".concat(e,"/owner")}).then(function(e){return c.put(e,n,{headers:t})});var e,n,t})),n=(n=_.isUndefined(r.delegatedBy)||r.delegatedBy===t.delegatedBy?n:n.then(null===r.delegatedBy?function(){return h(e=t).then(function(e){return c.delete("".concat(e,"/delegatedby"))}).then(function(){return w(e)});var e}:function(){return e=a,n={delegatedBy:r.delegatedBy},t={"Content-Type":f.mimeType("userDelegatedByReference")},e.then(function(e){return"".concat(e,"/delegatedby")}).then(function(e){return c.put(e,n,{headers:t})});var e,n,t})).then(function(){return o?S():w(r)})}).then(function(e){return t.$emit("c8yUser:update",{user:e.data,res:e}),e})}function P(e,n){var t,r;return e.id?T(e,n):(t=p(e,!1),r=_.cloneDeep(l),g().then(function(e){return c.post(e,t,r)}))}function A(n){return O(n).then(function(e){return e?o.updatePassword(n.password||o.getPassword()):s.resolve()})}function O(e){var n=e.id||e;return m().then(function(e){return s.when(e.id===n)})}function j(e){return _.get(e,"groups.references",[]).map(function(e){return e.group})}function U(e){var n=o.headers();return e&&(n.Authorization="Basic ".concat(e)),_.assign(n,f.contentHeaders("user",!0))}function k(){return m().then(function(e){return E(e)}).then(function(e){return e.enabledOnSystemLevel||e.enabledOnTenantLevel})}function E(e,n){n=n||v(e.self);return r.getTfaSettings(n)}function I(e,n){e=_.some(j(e),function(e){return e.name===n.enforcedUsersGroup});return n.enforcedOnSystemLevel||n.totpEnforcedOnTenantLevel||e}function C(e){return"".concat(e,"/roles/inventory")}return t.$on("authStateChange",function(e,n){n.hasAuth||(i=null)}),{current:m,getCurrentUser:function(){return i},checkIfCurrent:O,listAll:function(e){function r(e){o.push.apply(o,_toConsumableArray(e));var n=e.statistics.pageSize,t=e.paging.next,n=e.length>=n;return t=t&&n?e.paging.next().then(r):s.resolve(o)}var o=[];return b(_objectSpread({pageSize:f.MAX_PAGESIZE},e)).then(r)},list:b,detail:w,detailCurrent:S,remove:function(e){return h(e).then(function(e){return c.delete(e)})},enable:function(e){return P({id:e.id||e,enabled:!0})},disable:function(e){return P({id:e.id||e,enabled:!1})},save:P,saveCurrent:function(e){return P(e,!0)},savePhoneNumber:function(e,n){var t=f.url("user/currentUserPhone"),e={headers:U(o.encodeToken(e.name,e.password,e.tenant)),method:"PUT",url:t,data:{phone:n},silentError:!0};return c(e)},groups:j,isDeviceUser:function(e){return e.id.match(/^device_/)},isServiceUser:function(e){var n;return n=(e.id||e).match(/^service_/)?!0:n},hasRole:function(e,n){return function(e,n){var t=!1,e=_.get(e,"roles.references");e&&_.forEach(e,function(e){e.role.id===n&&(t=!0)});return t}(e,n)||function(e,n){var t=!1,e=_.get(e,"groups.references");e&&_.forEach(e,function(e){_.forEach(e.group.roles.references,function(e){e.role.id===n&&(t=!0)})});return t}(e,n)},getDevicePermissions:function(e,n){var t={params:f.pageSizeFilter({moId:n})};return h(e).then(function(e){return c.get("".concat(e,"/devicePermissions"),t)})},login:function(e,n,t,r){return n=o.encodeToken(n,t,e),o.setAuthToken(n).then(function(){return o.saveAuthToken(r)})},logout:function(){return o.logout()},revokeTokens:function(){return m().then(function(e){return f.url(d("user/logout/{tenant}/allUsers",e.tenant))}).then(function(e){return c.post(e)})},isAdmin:function(e){return _.some(e.groups.references,function(e){return"admins"===e.group.name})},changePassword:function(i,e,n){var a={newPassword:e,currentUserPassword:n};return O(i).then(function(e){return e?(r=i,o=a,u={"content-type":"application/json"},y().then(function(e){return c.put("".concat(e,"/password"),o,{headers:u})}).then(function(){return A(r)})):(n=a,t={"content-type":"application/json"},h(i).then(function(e){return c.put("".concat(e,"/password"),n,{headers:t})}));var n,t,r,o,u})},isCurrentPassword:function(e){return o.getPassword()===e},isTfaAvailable:k,isTfaActive:function(t){return _.isUndefined(t.id)?k():s.when(t).then(function(e){var n=e.twoFactorAuthenticationEnabled;return E(t).then(function(e){return"TOTP"!==e.strategy&&!!I(t,e)||n})})},getTenantTfaSettings:E,isEnforcedForUser:I,getTfaStrategy:function(){return e.detailValue({category:"two-factor-authentication",key:"strategy"},"SMS")},getHeaders:U,activateSupportUser:function(){var e=f.url("tenant/support-user/enable");return c.put(e)},deactivateSupportUser:function(){var e=f.url("tenant/support-user/disable");return c.put(e)},delegateTo:function(e){var n={id:e.id};return m().then(function(e){return n.delegatedBy=e.id,T(n)})},setUserTfaSettings:function(e,n){var t={"content-type":"application/json"};return h(e.id||e.userName).then(function(e){e="".concat(e,"/tfa");return c.put(e,n,{headers:t})})},getUserTfaSettings:function(e){return h(e).then(function(e){e="".concat(e,"/tfa");return c.get(e)})},hasExternalOrigin:function(e){return e.customProperties&&"OAUTH2"===e.customProperties.userOrigin},listInventoryRoles:function(e){return(e?s.resolve(e):m()).then(h).then(C).then(function(e){return c.get(e)})},assignInventoryRoles:function(e,n,t){var e=e?s.resolve(e):m(),r={managedObject:n,roles:_.map(t,function(e){return _.pick(e,"id")})};return e.then(h).then(C).then(function(e){return c.post(e,r)})},updateInventoryRoles:function(e,n,t){var e=e?s.resolve(e):m(),r={roles:_.map(t,function(e){return _.pick(e,"id")})};return e.then(h).then(C).then(function(e){return c.put("".concat(e,"/").concat(n),r)})},removeInventoryRoles:function(e,n){return(e?s.resolve(e):m()).then(h).then(C).then(function(e){return c.delete("".concat(e,"/").concat(n))})}}}e.$inject=["$http","$q","$rootScope","c8yBase","c8yAuth","c8ySettings","c8yTfaSettings"],angular.module("c8y.core").factory("c8yUser",e)}();
@@ -116,7 +116,7 @@
116
116
  aria-label="{{ 'Help' | translate }}"
117
117
  type="button"
118
118
  uib-popover="{{
119
- 'A user managed via your authorization server cannot change the email of the user.'
119
+ 'You cannot change the email of other users, and of your own (if it\'s managed through your authorization server).'
120
120
  | translate
121
121
  }}"
122
122
  popover-trigger="'focus'"
@@ -1 +1 @@
1
- "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){function e(u,l,g,f,p,m,w,h,E,A,S,y,v){return e.$inject=["$scope","$q"],{restrict:"EA",scope:{user:"=",forms:"=",password:"=",hideUsername:"=?",hideActive:"=?",hideFirstName:"=?",hideLastName:"=?",hideEmail:"=?",hideTelephone:"=?",hideCustomProperties:"=?",hideTfaOption:"=?",hidePasswordReset:"=?",hideChangePassword:"=?",hideOwner:"=?",hideDelegate:"=?",disabledEdit:"=?",hideLanguage:"=?",userTfaEnforced:"=?",topLevelTfaEnforced:"=?"},templateUrl:":::PLUGIN_PATH:::/ui/user/editUser.directive.html",controller:e,controllerAs:"vm",link:function(e,t){$(t).find("input[name=email]").bind("blur",function(){e.emailWarning=!(e.user&&e.user.email)})}};function e(o,r){var e="maxlength",a=y("Messaging application is not subscribed."),i={NEWUSERNAME:{type:"validation",text:y('Username "new" is not allowed.')},PATTERN:{type:"pattern",text:y("Invalid pattern.")},PATTERN_PASSWORD:{type:"pattern",text:v.getString(E.validation.password.message)},PATTERN_USERNAME:{type:"pattern",text:v.getString(E.validation.user.message)},PATTERN_DISPLAYNAME:{type:"pattern",text:v.getString(E.validation.loginAlias.message)},SAME_AS_CURRENT_PASSWORD:{type:"same_as_current",text:y("New password can't be the same as current one.")},PASSWORD_MISSMATCH:{type:"password_missmatch",text:y("Password confirmation does not match.")},REQUIRED:{type:"required",text:y("This field is required.")},EMAIL:{type:"email",text:y("Invalid email address.")},PASSWORD_STRENGTH:{type:"password_strength",text:y("Password not good enough, password must be stronger (green).")},INTERNATIONALPHONENUMBER_PHONE:{type:"internationalPhoneNumber",text:v.getString(E.validation.internationalPhoneNumber.message)},MAXLENGTH_FIRSTNAME:{type:e,text:"".concat(v.getString("Max length:")," 50")},MAXLENGTH_LASTNAME:{type:e,text:"".concat(v.getString("Max length:")," 50")},MAXLENGTH_USERNAME:{type:e,text:"".concat(v.getString("Max length:")," 254")},MAXLENGTH_DISPLAYNAME:{type:e,text:"".concat(v.getString("Max length:")," 254")},MAXLENGTH_PHONE:{type:e,text:"".concat(v.getString("Max length:")," 254")},MAXLENGTH_EMAIL:{type:e,text:"".concat(v.getString("Max length:")," 254")}},d=this,c=(_.assign(o,{confirmPassword:"",invalid:angular.bind(u,u.invalid,o.forms,"userForm"),isInvalidConfirmPassword:function(){var e=o.forms.userForm,t=e.password.$pristine,e=e.confirmPassword.$invalid;return!t&&e},changePasswordConfirm:function(){o.forms.userForm.confirmPassword&&o.forms.userForm.confirmPassword.$setValidity(i.PASSWORD_MISSMATCH.type,o.forms.userForm.confirmPassword.$viewValue===o.user.password)},getErrorFeedback:function(n){var a=o.forms.userForm[n]||{},s=[];return _.forEach(a.$error||{},function(e,t){var r;"parse"===t?o.forms.userForm.phone.$setValidity(t,!0):(t=t.toUpperCase(),r="".concat(t,"_").concat(n.toUpperCase()),e&&a.$touched&&(e=i[r]||i[t],s.push(v.getString(e.text))))}),s.join(" ")},getUserCustomProperties:function(e){var r={};e&&e.customProperties&&_.forEach(e.customProperties,function(e,t){"userOrigin"!==t&&(r[t]="object"===_typeof(e)?angular.toJson(e):e)});return r},humanize:u.humanizeFragment,passwordRegex:E.validation.password.pattern,resetPasswords:function(e){var t=v.getString("A user managed via your authorization server cannot change the password of the user.");l.current().then(function(e){e=l.hasExternalOrigin(e);o.password.showPassword&&e&&S.add({text:t,type:"warning"})}),o.password.showPassword=!o.password.showPassword,e.passwordStrength=o.password.strength,e.password=null,o.confirmPassword=""},tfaAvailable:!1,delegateTo:function(){l.current().then(function(e){o.user.delegatedBy=e.id}),n()},undelegate:function(){o.user.delegatedBy=null,n()},setOwner:function(e){o.user.owner=e,d.isParentDropDownOpen=!1,d.ownerHiddenForm.$setDirty()},userCanChangePasswordAndEmail:!1}),_.assign(d,{onToggleDropdown:function(e){e&&(d.ownerDropDownInitialized=!0)},twoFactorAuthenticationCheckboxDisabled:function(){return o.topLevelTfaEnforced||o.disabledEdit||"TOTP"===d.tfaStrategy||!o.smsMicroserviceAvailable||!o.notCurrentUser&&"SMS"===d.tfaStrategy},enforceTfaCheckboxDisbaled:function(){return o.topLevelTfaEnforced||o.disabledEdit||!o.notCurrentUser||s()},messagingWarningVisible:function(){return!o.smsMicroserviceAvailable&&"SMS"===d.tfaStrategy},shouldEnableRevokeTOTPSecretButton:s}),p.getStrongPasswordSettings().then(t),o.$watch("user",function(e,t){var n,s;e&&e!==t&&(s=!(n=e).id,o.password.strength=n.passwordStrength,o.changePasswordBtn=!o.password.showPassword,o.emailWarning=!n.email,o.smsWarningPopover=a,s&&(n.sendPasswordResetEmail=!0),delete o.confirmPassword,o.notCurrentUser=null,t=/.*/,(e=n)&&!e.id&&(t=E.validation.user.pattern),o.userNamePattern=t,o.loginAliasPattern=E.validation.loginAlias.pattern,o.hideLanguage||g.get("language").then(function(e){e&&(o.user.language={name:h.getLanguageNativeName(e),code:e}),o.languages=_.map(m.getSupportedLanguages(),function(e){return Object.assign({name:h.getLanguageNativeName(e),code:e},{})})}),A.isActivatedFor("units-conversion")&&(o.unitsConversionActive=!0),r.all({tfaAvailable:l.isTfaAvailable(),smsMicroserviceAvailable:w.isAvailable({contextPath:"messaging"}),twoFactorAuthenticationEnabled:l.isTfaActive(n),tfaStrategy:l.getTfaStrategy(),isCurrentUser:l.checkIfCurrent(n)}).then(function(e){var t=e.tfaAvailable,r=e.smsMicroserviceAvailable,n=e.twoFactorAuthenticationEnabled,a=e.tfaStrategy,e=e.isCurrentUser;o.notCurrentUser=!e,o.tfaAvailable=t,o.smsMicroserviceAvailable=!!r,d.tfaStrategy=a,o.user.twoFactorAuthenticationEnabled=!s&&n,o.userCanChangePasswordAndEmail=s||!l.hasExternalOrigin(o.user)}),o.hideOwner||(o.ownerEditDisabled=!1,l.current().then(function(e){var t=f.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN"),r=f.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE");!t&&r&&(d.rootOwner=[e],d.currentOwner=e.id,d.defaultOwner=e,s)&&(o.ownerEditDisabled=!0,n.owner=d.currentOwner)})),c())}));function t(e){var t=e.enforceStrength,e=e.strengthValidity,t=t||e;(o.passwordStrengthEnforced=t)&&o.$watch("user.passwordStrength",function(e){e&&o.password.showPassword&&o.forms.userForm.password.$setValidity(i.PASSWORD_STRENGTH.type,"GREEN"===o.user.passwordStrength)})}function n(){o.delegationHiddenForm.$setDirty()}function s(){return"TOTP"===d.tfaStrategy&&o.user.twoFactorAuthenticationEnabled}o.$watch("user.password",function(){o.forms.userForm&&o.forms.userForm.password&&o.forms.userForm.password.$setValidity(i.SAME_AS_CURRENT_PASSWORD.type,!o.notCurrentUser&&!l.isCurrentPassword(o.user.password)||o.notCurrentUser)})}}e.$inject=["c8yBase","c8yUser","c8yUserPreferences","c8yPermissions","c8yLoginOptions","c8yLocales","c8yApplication","LocalesUtil","c8yConfig","c8yBeta","c8yAlert","gettext","gettextCatalog"],angular.module("c8y.ui").directive("c8yEditUser",e).directive("c8yUiEditUser",e)}();
1
+ "use strict";function _typeof(e){return(_typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(e){return typeof e}:function(e){return e&&"function"==typeof Symbol&&e.constructor===Symbol&&e!==Symbol.prototype?"symbol":typeof e})(e)}!function(){function e(u,l,g,f,p,m,w,h,E,A,S,y,v){return e.$inject=["$scope","$q"],{restrict:"EA",scope:{user:"=",forms:"=",password:"=",hideUsername:"=?",hideActive:"=?",hideFirstName:"=?",hideLastName:"=?",hideEmail:"=?",hideTelephone:"=?",hideCustomProperties:"=?",hideTfaOption:"=?",hidePasswordReset:"=?",hideChangePassword:"=?",hideOwner:"=?",hideDelegate:"=?",disabledEdit:"=?",hideLanguage:"=?",userTfaEnforced:"=?",topLevelTfaEnforced:"=?"},templateUrl:":::PLUGIN_PATH:::/ui/user/editUser.directive.html",controller:e,controllerAs:"vm",link:function(e,t){$(t).find("input[name=email]").bind("blur",function(){e.emailWarning=!(e.user&&e.user.email)})}};function e(o,r){var e="maxlength",a=y("Messaging application is not subscribed."),i={NEWUSERNAME:{type:"validation",text:y('Username "new" is not allowed.')},PATTERN:{type:"pattern",text:y("Invalid pattern.")},PATTERN_PASSWORD:{type:"pattern",text:v.getString(E.validation.password.message)},PATTERN_USERNAME:{type:"pattern",text:v.getString(E.validation.user.message)},PATTERN_DISPLAYNAME:{type:"pattern",text:v.getString(E.validation.loginAlias.message)},SAME_AS_CURRENT_PASSWORD:{type:"same_as_current",text:y("New password can't be the same as current one.")},PASSWORD_MISSMATCH:{type:"password_missmatch",text:y("Password confirmation does not match.")},REQUIRED:{type:"required",text:y("This field is required.")},EMAIL:{type:"email",text:y("Invalid email address.")},PASSWORD_STRENGTH:{type:"password_strength",text:y("Password not good enough, password must be stronger (green).")},INTERNATIONALPHONENUMBER_PHONE:{type:"internationalPhoneNumber",text:v.getString(E.validation.internationalPhoneNumber.message)},MAXLENGTH_FIRSTNAME:{type:e,text:"".concat(v.getString("Max length:")," 50")},MAXLENGTH_LASTNAME:{type:e,text:"".concat(v.getString("Max length:")," 50")},MAXLENGTH_USERNAME:{type:e,text:"".concat(v.getString("Max length:")," 254")},MAXLENGTH_DISPLAYNAME:{type:e,text:"".concat(v.getString("Max length:")," 254")},MAXLENGTH_PHONE:{type:e,text:"".concat(v.getString("Max length:")," 254")},MAXLENGTH_EMAIL:{type:e,text:"".concat(v.getString("Max length:")," 254")}},d=this,c=(_.assign(o,{confirmPassword:"",invalid:angular.bind(u,u.invalid,o.forms,"userForm"),isInvalidConfirmPassword:function(){var e=o.forms.userForm,t=e.password.$pristine,e=e.confirmPassword.$invalid;return!t&&e},changePasswordConfirm:function(){o.forms.userForm.confirmPassword&&o.forms.userForm.confirmPassword.$setValidity(i.PASSWORD_MISSMATCH.type,o.forms.userForm.confirmPassword.$viewValue===o.user.password)},getErrorFeedback:function(n){var a=o.forms.userForm[n]||{},s=[];return _.forEach(a.$error||{},function(e,t){var r;"parse"===t?o.forms.userForm.phone.$setValidity(t,!0):(t=t.toUpperCase(),r="".concat(t,"_").concat(n.toUpperCase()),e&&a.$touched&&(e=i[r]||i[t],s.push(v.getString(e.text))))}),s.join(" ")},getUserCustomProperties:function(e){var r={};e&&e.customProperties&&_.forEach(e.customProperties,function(e,t){"userOrigin"!==t&&(r[t]="object"===_typeof(e)?angular.toJson(e):e)});return r},humanize:u.humanizeFragment,passwordRegex:E.validation.password.pattern,resetPasswords:function(e){var t=v.getString("A user managed via your authorization server cannot change the password of the user.");l.current().then(function(e){e=l.hasExternalOrigin(e);o.password.showPassword&&e&&S.add({text:t,type:"warning"})}),o.password.showPassword=!o.password.showPassword,e.passwordStrength=o.password.strength,e.password=null,o.confirmPassword=""},tfaAvailable:!1,delegateTo:function(){l.current().then(function(e){o.user.delegatedBy=e.id}),n()},undelegate:function(){o.user.delegatedBy=null,n()},setOwner:function(e){o.user.owner=e,d.isParentDropDownOpen=!1,d.ownerHiddenForm.$setDirty()},userCanChangePasswordAndEmail:!1}),_.assign(d,{onToggleDropdown:function(e){e&&(d.ownerDropDownInitialized=!0)},twoFactorAuthenticationCheckboxDisabled:function(){return o.topLevelTfaEnforced||o.disabledEdit||"TOTP"===d.tfaStrategy||!o.smsMicroserviceAvailable||!o.notCurrentUser&&"SMS"===d.tfaStrategy},enforceTfaCheckboxDisbaled:function(){return o.topLevelTfaEnforced||o.disabledEdit||!o.notCurrentUser||s()},messagingWarningVisible:function(){return!o.smsMicroserviceAvailable&&"SMS"===d.tfaStrategy},shouldEnableRevokeTOTPSecretButton:s}),p.getStrongPasswordSettings().then(t),o.$watch("user",function(e,t){var n,s;e&&e!==t&&(s=!(n=e).id,o.password.strength=n.passwordStrength,o.changePasswordBtn=!o.password.showPassword,o.emailWarning=!n.email,o.smsWarningPopover=a,s&&(n.sendPasswordResetEmail=!0),delete o.confirmPassword,o.notCurrentUser=null,t=/.*/,(e=n)&&!e.id&&(t=E.validation.user.pattern),o.userNamePattern=t,o.loginAliasPattern=E.validation.loginAlias.pattern,o.hideLanguage||g.get("language").then(function(e){e&&(o.user.language={name:h.getLanguageNativeName(e),code:e}),o.languages=_.map(m.getSupportedLanguages(),function(e){return Object.assign({name:h.getLanguageNativeName(e),code:e},{})})}),A.isActivatedFor("units-conversion")&&(o.unitsConversionActive=!0),r.all({tfaAvailable:l.isTfaAvailable(),smsMicroserviceAvailable:w.isAvailable({contextPath:"messaging"}),twoFactorAuthenticationEnabled:l.isTfaActive(n),tfaStrategy:l.getTfaStrategy(),isCurrentUser:l.checkIfCurrent(n)}).then(function(e){var t=e.tfaAvailable,r=e.smsMicroserviceAvailable,n=e.twoFactorAuthenticationEnabled,a=e.tfaStrategy,e=e.isCurrentUser;o.notCurrentUser=!e,o.tfaAvailable=t,o.smsMicroserviceAvailable=!!r,d.tfaStrategy=a,o.user.twoFactorAuthenticationEnabled=!s&&n,o.userCanChangePasswordAndEmail=s||!l.hasExternalOrigin(o.user)&&e}),o.hideOwner||(o.ownerEditDisabled=!1,l.current().then(function(e){var t=f.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN"),r=f.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE");!t&&r&&(d.rootOwner=[e],d.currentOwner=e.id,d.defaultOwner=e,s)&&(o.ownerEditDisabled=!0,n.owner=d.currentOwner)})),c())}));function t(e){var t=e.enforceStrength,e=e.strengthValidity,t=t||e;(o.passwordStrengthEnforced=t)&&o.$watch("user.passwordStrength",function(e){e&&o.password.showPassword&&o.forms.userForm.password.$setValidity(i.PASSWORD_STRENGTH.type,"GREEN"===o.user.passwordStrength)})}function n(){o.delegationHiddenForm.$setDirty()}function s(){return"TOTP"===d.tfaStrategy&&o.user.twoFactorAuthenticationEnabled}o.$watch("user.password",function(){o.forms.userForm&&o.forms.userForm.password&&o.forms.userForm.password.$setValidity(i.SAME_AS_CURRENT_PASSWORD.type,!o.notCurrentUser&&!l.isCurrentPassword(o.user.password)||o.notCurrentUser)})}}e.$inject=["c8yBase","c8yUser","c8yUserPreferences","c8yPermissions","c8yLoginOptions","c8yLocales","c8yApplication","LocalesUtil","c8yConfig","c8yBeta","c8yAlert","gettext","gettextCatalog"],angular.module("c8y.ui").directive("c8yEditUser",e).directive("c8yUiEditUser",e)}();
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@c8y/ng1-modules",
3
- "version": "1018.504.16",
3
+ "version": "1018.505.4",
4
4
  "license": "Apache-2.0",
5
5
  "author": "Cumulocity",
6
6
  "description": "AngularJS modules for Cumulocity IoT applications.",
@@ -176,7 +176,7 @@
176
176
  ng-maxlength="256"
177
177
  c8y-autocomplete="off"
178
178
  ng-required="true"
179
- ng-disabled="!isNew && !tenant.adminName"
179
+ ng-disabled="!isNew"
180
180
  />
181
181
  <c8y-error-feedback field="tenantForm.adminEmail"></c8y-error-feedback>
182
182
  </div>
@@ -222,33 +222,10 @@
222
222
  </div>
223
223
 
224
224
  <div ng-if="!tenant.sendPasswordResetEmail">
225
- <div
226
- class="form-group"
227
- ng-if="!isNew"
228
- >
229
- <button
230
- class="btn btn-default change-password-btn"
231
- type="button"
232
- ng-click="resetPassword()"
233
- >
234
- <div
235
- title="{{ 'Change password' | translate }}"
236
- ng-if="!changePassword"
237
- >
238
- {{ 'Change password' | translate }}
239
- </div>
240
- <div
241
- title="{{ 'Cancel password change' | translate }}"
242
- ng-if="changePassword"
243
- >
244
- {{ 'Cancel password change' | translate }}
245
- </div>
246
- </button>
247
- </div>
248
225
 
249
226
  <div
250
227
  class="row content-flex-50"
251
- ng-if="isNew || changePassword"
228
+ ng-if="isNew"
252
229
  >
253
230
  <div class="col-7">
254
231
  <div class="form-group">
@@ -1 +1 @@
1
- "use strict";!function(){function e(a,D,c,e,f,d,l,E,n,r,t,g,h,s,p,m){var o,i,u,w=this,R=(_.assign(w,{cancel:g.gotoList,shouldDisableGlobalRolesCheckbox:$,isUserAndRolesFormPristine:A,isUserFormInvalid:U,isRolesFormInvalid:I,canSave:function(){return!(c.saving||A()||U()||I())}}),e.userId),v=["business"];function N(){R?d.detail(R).then(function(e){return e.data}).then(T).then(function(){return d.getUserTfaSettings(c.user).then(f.getResData).then(function(e){c.userTfaEnforced=!!e.tfaEnforced})}):(T({enabled:c.isNew=!0}),G(m("New user"),!0))}function T(e){i=e.email,e.devicePermissions=e.devicePermissions||{},c.user=e,c._groups=O(e),c.password.showPassword=c.isNew,c.hasExternalOrigin=d.hasExternalOrigin(e),c.isNew&&(_.forEach(c.groups,function(e){_.includes(v,e.name)&&(c._groups[e.id]=!0)}),u)&&E.warning(g.LOCAL_USER_TEXT),c.hasExternalOrigin&&s.isSsoClearingUserRolesOnEveryLogin().then(function(e){return c.userCanEditRoles=!e,c.userCanEditRoles}).then(function(e){e?E.warning(g.EXTERNAL_ORIGIN_DYNAMIC_ACCESS_MAPPING_EXCEPTION_TEXT):E.warning(g.EXTERNAL_ORIGIN_TEXT)})}function A(){return c.forms.userForm.$pristine&&c.forms.rolesForm.$pristine}function U(){return!!(M(c.currentUser,c.user)&&!c.hasExternalOrigin)&&c.forms.userForm.$invalid}function I(){return!$()&&c.forms.rolesForm.$invalid}function O(e){return _.reduce(_.get(e,"groups.references"),function(e,n){return e[n.group.id]=!0,e},{})}function y(e){c.groups=e}function C(e){c.currentUser=e}function L(n,e){function r(){return E.success(m("User saved."))}var t=1<arguments.length&&void 0!==e?e:"",e=(c.saving=!0,g.gotoList),s=!(n.id&&!n.groups),o=_(c._groups).map(function(e,n){return e&&parseInt(n,10)}).filter().value(),i=s?function(){return l.updateGroups(0<arguments.length&&void 0!==arguments[0]?arguments[0]:n,o)}:function(){return a.resolve()},s=c.forms.rolesForm.$dirty,u=c.password.showPassword;try{(c.hasExternalOrigin?g.warnAboutUserLogOutIfNeeded(n,{rolesChanged:s,passwordChanged:u}).then(function(){return i()}):g.warnAboutUserLogOutIfNeeded(n,{rolesChanged:s,passwordChanged:u}).then(function(){return n.password&&!c.isNew?d.changePassword(n,n.password,t):a.resolve()}).then(function(){return d.current()}).then(function(e){return _.isEqual(e.userName,n.userName)}).then(function(e){p.isActivatedFor("units-conversion")&&(e&&(e=n,e=_.get(n,"measurementUnit.value"),h.set("unit",e)),_.unset(n,"measurementUnit"))}).then(function(e){return d.save(_.omit(n,c.isNew?["measurementUnit"]:["measurementUnit","password"]),e)}).then(f.getResData).then(function(e){return i(e)}).then(function(){return d.setUserTfaSettings(n,{tfaEnforced:!!c.userTfaEnforced})})).then(r).then(e).finally(function(){c.saving=!1})}catch(e){E.danger(e.message),c.saving=!1}}function G(){return n.changeTitle({title:0<arguments.length&&void 0!==arguments[0]?arguments[0]:""},{skipTitleTranslation:!(1<arguments.length&&void 0!==arguments[1]&&arguments[1])})}function P(e){return d.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")||d.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE")}function M(e,n){return!(!e||!n)&&(!n.id||(e.id===n.id?d.hasRole(e,"ROLE_USER_MANAGEMENT_OWN_ADMIN"):d.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")||d.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE")))}function S(e){return _.get(c.user,"owner")&&o&&!o[e.id]}function $(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,n=P(c.currentUser),e=!e||!S(e),r=!!c.userCanEditRoles||!c.hasExternalOrigin;return!(n&&e&&r)}c.checkPassword=function(n){var e=!c.isNew,r=c.password.showPassword||function(e){return e.email!==i}(n);return e&&r?t.currentPassword().then(function(e){return L(n,e)}).catch(function(e){e&&E.danger(f.getResErrorMessage(e)),N()}):L(n)},c.$watch("user.userName",G),c.$watch("user.owner",function(e){e?d.detail(e).then(f.getResData).then(function(e){o=O(e),_.forEach(c._groups,function(e,n){c._groups[n]=e&&o[n]})}):o=null}),c.$watch("_groups",function(e){c.enforcedGroup&&(c.topLevelTfaEnforced=e[c.enforcedGroup.id])},!0),c.canEditUser=M,c.canEditUserGroups=P,c.canActivateUser=function(e,n){return!(!e||!n)&&e.id!==n.id},c.forms={},c.password={},c.saving=!1,c.showAcl=function(){var e=_.get(c.user,"devicePermissions"),e=_.keys(e);return f.getFlag("deprecated")||e.length},c.restrictedByOwner=S,c.$on("$destroy",function(){E.remove({text:g.EXTERNAL_ORIGIN_TEXT,type:"warning"}),E.remove({text:g.EXTERNAL_ORIGIN_DYNAMIC_ACCESS_MAPPING_EXCEPTION_TEXT,type:"warning"}),E.remove({text:g.LOCAL_USER_TEXT,type:"warning"})}),l.list(void 0).then(y).then(s.isSsoEnabled).then(function(e){u=e}).then(N).then(function(){return r.current().then(function(e){return d.getTenantTfaSettings(c.user,e.name)}).then(function(e){c.enforcedGroup=_.find(c.groups,{name:e.enforcedUsersGroup}),c.topLevelTfaEnforced=d.isEnforcedForUser(c.user,e)||c._groups[c.enforcedGroup.id]})}),d.current().then(C),g.userHierarchyActive().then(function(e){w.FEATURE_USER_HIERARCHY=e})}e.$inject=["$q","$injector","$scope","$routeParams","c8yBase","c8yUser","c8yUserGroup","c8yAlert","c8yTitle","c8yTenant","c8yUserUtil","c8yUsersUi","c8yUserPreferences","c8yLoginOptions","c8yBeta","gettext"],angular.module("c8y.users").component("c8yUserDetailView",{templateUrl:":::PLUGIN_PATH:::/userDetailView/userDetailView.html",controller:e,controllerAs:"vm"})}();
1
+ "use strict";!function(){function e(a,D,c,e,f,d,l,E,n,r,t,g,h,s,p,m){var o,i,u,w=this,v=(_.assign(w,{cancel:g.gotoList,shouldDisableGlobalRolesCheckbox:$,isUserAndRolesFormPristine:A,isUserFormInvalid:U,isRolesFormInvalid:I,canSave:function(){return!(c.saving||A()||U()||I())}}),e.userId),R=["business"];function N(){v?d.detail(v).then(function(e){return e.data}).then(T).then(function(){return d.getUserTfaSettings(c.user).then(f.getResData).then(function(e){c.userTfaEnforced=!!e.tfaEnforced})}):(T({enabled:c.isNew=!0}),G(m("New user"),!0))}function T(e){i=e.email,e.devicePermissions=e.devicePermissions||{},c.user=e,c._groups=O(e),c.password.showPassword=c.isNew,c.hasExternalOrigin=d.hasExternalOrigin(e),c.isNew&&(_.forEach(c.groups,function(e){_.includes(R,e.name)&&(c._groups[e.id]=!0)}),u)&&E.warning(g.LOCAL_USER_TEXT),c.hasExternalOrigin&&s.isSsoClearingUserRolesOnEveryLogin().then(function(e){return c.userCanEditRoles=!e,c.userCanEditRoles}).then(function(e){e?E.warning(g.EXTERNAL_ORIGIN_DYNAMIC_ACCESS_MAPPING_EXCEPTION_TEXT):E.warning(g.EXTERNAL_ORIGIN_TEXT)})}function A(){return c.forms.userForm.$pristine&&c.forms.rolesForm.$pristine}function U(){return!!(M(c.currentUser,c.user)&&!c.hasExternalOrigin)&&c.forms.userForm.$invalid}function I(){return!$()&&c.forms.rolesForm.$invalid}function O(e){return _.reduce(_.get(e,"groups.references"),function(e,n){return e[n.group.id]=!0,e},{})}function y(e){c.groups=e}function C(e){c.currentUser=e}function L(r,e){function n(){return E.success(m("User saved."))}var t=1<arguments.length&&void 0!==e?e:"",e=(c.saving=!0,g.gotoList),s=!(r.id&&!r.groups),o=_(c._groups).map(function(e,n){return e&&parseInt(n,10)}).filter().value(),i=s?function(){return l.updateGroups(0<arguments.length&&void 0!==arguments[0]?arguments[0]:r,o)}:function(){return a.resolve()},s=c.forms.rolesForm.$dirty,u=c.password.showPassword;try{(c.hasExternalOrigin?g.warnAboutUserLogOutIfNeeded(r,{rolesChanged:s,passwordChanged:u}).then(function(){return i()}):g.warnAboutUserLogOutIfNeeded(r,{rolesChanged:s,passwordChanged:u}).then(function(){return r.password&&!c.isNew?d.changePassword(r,r.password,t):a.resolve()}).then(function(){return d.current()}).then(function(e){return _.isEqual(e.userName,r.userName)}).then(function(e){var n;return p.isActivatedFor("units-conversion")&&(e&&(n=r,n=_.get(r,"measurementUnit.value"),h.set("unit",n)),_.unset(r,"measurementUnit")),e}).then(function(e){return d.save(_.omit(r,c.isNew?["measurementUnit"]:["measurementUnit","password"]),e)}).then(f.getResData).then(function(e){return i(e)}).then(function(){return d.setUserTfaSettings(r,{tfaEnforced:!!c.userTfaEnforced})})).then(n).then(e).finally(function(){c.saving=!1})}catch(e){E.danger(e.message),c.saving=!1}}function G(){return n.changeTitle({title:0<arguments.length&&void 0!==arguments[0]?arguments[0]:""},{skipTitleTranslation:!(1<arguments.length&&void 0!==arguments[1]&&arguments[1])})}function P(e){return d.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")||d.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE")}function M(e,n){return!(!e||!n)&&(!n.id||(e.id===n.id?d.hasRole(e,"ROLE_USER_MANAGEMENT_OWN_ADMIN"):d.hasRole(e,"ROLE_USER_MANAGEMENT_ADMIN")||d.hasRole(e,"ROLE_USER_MANAGEMENT_CREATE")))}function S(e){return _.get(c.user,"owner")&&o&&!o[e.id]}function $(){var e=0<arguments.length&&void 0!==arguments[0]?arguments[0]:null,n=P(c.currentUser),e=!e||!S(e),r=!!c.userCanEditRoles||!c.hasExternalOrigin;return!(n&&e&&r)}c.checkPassword=function(n){var e=!c.isNew,r=c.password.showPassword||function(e){return e.email!==i}(n);return e&&r?t.currentPassword().then(function(e){return L(n,e)}).catch(function(e){e&&E.danger(f.getResErrorMessage(e)),N()}):L(n)},c.$watch("user.userName",G),c.$watch("user.owner",function(e){e?d.detail(e).then(f.getResData).then(function(e){o=O(e),_.forEach(c._groups,function(e,n){c._groups[n]=e&&o[n]})}):o=null}),c.$watch("_groups",function(e){c.enforcedGroup&&(c.topLevelTfaEnforced=e[c.enforcedGroup.id])},!0),c.canEditUser=M,c.canEditUserGroups=P,c.canActivateUser=function(e,n){return!(!e||!n)&&e.id!==n.id},c.forms={},c.password={},c.saving=!1,c.showAcl=function(){var e=_.get(c.user,"devicePermissions"),e=_.keys(e);return f.getFlag("deprecated")||e.length},c.restrictedByOwner=S,c.$on("$destroy",function(){E.remove({text:g.EXTERNAL_ORIGIN_TEXT,type:"warning"}),E.remove({text:g.EXTERNAL_ORIGIN_DYNAMIC_ACCESS_MAPPING_EXCEPTION_TEXT,type:"warning"}),E.remove({text:g.LOCAL_USER_TEXT,type:"warning"})}),l.list(void 0).then(y).then(s.isSsoEnabled).then(function(e){u=e}).then(N).then(function(){return r.current().then(function(e){return d.getTenantTfaSettings(c.user,e.name)}).then(function(e){c.enforcedGroup=_.find(c.groups,{name:e.enforcedUsersGroup}),c.topLevelTfaEnforced=d.isEnforcedForUser(c.user,e)||c._groups[c.enforcedGroup.id]})}),d.current().then(C),g.userHierarchyActive().then(function(e){w.FEATURE_USER_HIERARCHY=e})}e.$inject=["$q","$injector","$scope","$routeParams","c8yBase","c8yUser","c8yUserGroup","c8yAlert","c8yTitle","c8yTenant","c8yUserUtil","c8yUsersUi","c8yUserPreferences","c8yLoginOptions","c8yBeta","gettext"],angular.module("c8y.users").component("c8yUserDetailView",{templateUrl:":::PLUGIN_PATH:::/userDetailView/userDetailView.html",controller:e,controllerAs:"vm"})}();