Browse Source

fix: Added user management to org creator and user cannot delete themselves

pull/6785/head
Muhammed Mustafa 1 year ago
parent
commit
5271b59ef5
  1. 14
      packages/nc-gui/components/account/UserList.vue
  2. 2
      packages/nc-gui/lib/acl.ts
  3. 12
      packages/nocodb/src/utils/acl.ts

14
packages/nc-gui/components/account/UserList.vue

@ -15,6 +15,8 @@ const { t } = useI18n()
const { dashboardUrl } = useDashboard()
const { user: loggedInUser } = useGlobal()
const { copy } = useCopy()
const users = ref<UserType[]>([])
@ -269,11 +271,13 @@ const openDeleteModal = (user: UserType) => {
<div>{{ $t('activity.copyPasswordResetURL') }}</div>
</NcMenuItem>
</template>
<NcDivider v-if="!el.roles?.includes('super')" />
<NcMenuItem data-rec="true" class="!text-red-500 !hover:bg-red-50" @click="openDeleteModal(el)">
<MaterialSymbolsDeleteOutlineRounded />
{{ $t('general.remove') }} {{ $t('objects.user') }}
</NcMenuItem>
<template v-if="el.id !== loggedInUser?.id">
<NcDivider v-if="!el.roles?.includes('super')" />
<NcMenuItem data-rec="true" class="!text-red-500 !hover:bg-red-50" @click="openDeleteModal(el)">
<MaterialSymbolsDeleteOutlineRounded />
{{ $t('general.remove') }} {{ $t('objects.user') }}
</NcMenuItem>
</template>
</NcMenu>
</template>
</NcDropdown>

2
packages/nc-gui/lib/acl.ts

@ -20,6 +20,8 @@ const rolePermissions = {
[OrgUserRoles.SUPER_ADMIN]: '*',
[OrgUserRoles.CREATOR]: {
include: {
workspaceSettings: true,
superAdminUserManagement: true,
baseCreate: true,
baseMove: true,
baseDelete: true,

12
packages/nocodb/src/utils/acl.ts

@ -23,7 +23,13 @@ const permissionScopes = {
'baseCreate',
// User
'userList',
'userAdd',
'userUpdate',
'userDelete',
'passwordChange',
'userInviteResend',
'generateResetUrl',
// Plugin
'isPluginActive',
@ -242,6 +248,12 @@ const rolePermissions:
},
[OrgUserRoles.CREATOR]: {
include: {
userList: true,
userAdd: true,
userUpdate: true,
userDelete: true,
generateResetUrl: true,
userInviteResend: true,
upload: true,
uploadViaURL: true,
isPluginActive: true,

Loading…
Cancel
Save