diff --git a/src/app/mixins/baseMixins/accessControlMixin/accessControlMixin.js b/src/app/mixins/baseMixins/accessControlMixin/accessControlMixin.js index 66c2ede8e..ce94380ae 100644 --- a/src/app/mixins/baseMixins/accessControlMixin/accessControlMixin.js +++ b/src/app/mixins/baseMixins/accessControlMixin/accessControlMixin.js @@ -20,5 +20,8 @@ export default { route: this.$route, }); }, + hasReadAccessToContacts() { + return this.$store.getters['userinfo/HAS_ACCESS_TO_OBJECT']('contacts'); + }, }, }; diff --git a/src/modules/directory/modules/users/components/opened-user-general.vue b/src/modules/directory/modules/users/components/opened-user-general.vue index 8a358baa4..42a4ef527 100644 --- a/src/modules/directory/modules/users/components/opened-user-general.vue +++ b/src/modules/directory/modules/users/components/opened-user-general.vue @@ -44,7 +44,7 @@ /> - + diff --git a/src/modules/userinfo/store/_internals/lookups/ObjectsList.lookup.js b/src/modules/userinfo/store/_internals/lookups/ObjectsList.lookup.js index fc7eed94b..84d6bf01d 100644 --- a/src/modules/userinfo/store/_internals/lookups/ObjectsList.lookup.js +++ b/src/modules/userinfo/store/_internals/lookups/ObjectsList.lookup.js @@ -133,4 +133,12 @@ export default Object.freeze([ // PERMISSIONS { field: null, name: AdminSections.OBJECTS, route: RouteNames.OBJECTS }, // permissions: add { field: 'roles', name: AdminSections.ROLES, route: RouteNames.ROLES }, // scope: roles + + // Not used in ui sections + // it used for check if some entities have access to this object + { + field: 'contacts', + name: 'contacts', + route: null, // there is no associated section and route in Admin + }, ]); diff --git a/src/modules/userinfo/store/userinfo.js b/src/modules/userinfo/store/userinfo.js index 9870253d6..c96b7ad91 100644 --- a/src/modules/userinfo/store/userinfo.js +++ b/src/modules/userinfo/store/userinfo.js @@ -26,6 +26,14 @@ const getters = { }, []), IS_CHANGE_USER_PASSWORD_ALLOW: (state) => !!state.permissions.change_user_password, + + // FIXME: remove this getter after refactoring of userinfo module in SDK + HAS_ACCESS_TO_OBJECT: (state, getters) => (objectName) => { + const objectScope = getters.GET_OBJECT_SCOPE({ name: objectName }); + if (!objectScope) return false; + // don`t used existing HAS_READ_ACCESS, because it have CHECK_OBJECT_ACCESS inside (UI-access) + return objectScope.access.includes('r'); + }, }; const actions = {