Browse Source

feat(api): show password rest/invite url based on the user

Signed-off-by: Pranav C <pranavxc@gmail.com>
pull/4134/head
Pranav C 2 years ago
parent
commit
7a4bedce53
  1. 3
      packages/nc-gui/components/admin/Token.vue
  2. 43
      packages/nc-gui/components/admin/User.vue
  3. 1
      packages/nc-gui/lang/en.json
  4. 68
      packages/nc-gui/pages/admin/index.vue

3
packages/nc-gui/components/admin/Token.vue

@ -99,7 +99,7 @@ const copyToken = (token: string | undefined) => {
<div class="max-w-[900px] mx-auto p-4">
<div class="py-2 flex gap-4 items-center">
<div class="flex-grow"></div>
<MdiReload @click="loadTokens" class="cursor-pointer"/>
<MdiReload class="cursor-pointer" @click="loadTokens" />
<a-button size="small" @click="showNewTokenModal = true">
<div class="flex items-center gap-1">
<MdiAdd />
@ -136,7 +136,6 @@ const copyToken = (token: string | undefined) => {
</template>
</a-table-column>
<!-- Token -->
<a-table-column key="token" :title="$t('labels.token')" data-index="token">
<template #default="{ text, record }">

43
packages/nc-gui/components/admin/User.vue

@ -146,7 +146,7 @@ const copyPasswordResetUrl = async (user: User) => {
>
</a-input-search>
<div class="flex-grow"></div>
<MdiReload @click="loadUsers" class="cursor-pointer" />
<MdiReload class="cursor-pointer" @click="loadUsers" />
<a-button size="small" @click="showUserModal = true">
<div class="flex items-center gap-1">
<MdiAdd />
@ -190,14 +190,14 @@ const copyPasswordResetUrl = async (user: User) => {
<a-select-option :value="Role.OrgLevelCreator" :label="$t(`objects.roleType.orgLevelCreator`)">
<div>{{ $t(`objects.roleType.orgLevelCreator`) }}</div>
<span class="text-gray-500 text-xs whitespace-normal"
>Creator can create new projects and access any invited project.</span
>Creator can create new projects and access any invited project.</span
>
</a-select-option>
<a-select-option :value="Role.OrgLevelViewer" :label="$t(`objects.roleType.orgLevelViewer`)">
<div>{{ $t(`objects.roleType.orgLevelViewer`) }}</div>
<span class="text-gray-500 text-xs whitespace-normal"
>Viewer is not allowed to create new projects but they can access any invited project.</span
>Viewer is not allowed to create new projects but they can access any invited project.</span
>
</a-select-option>
</a-select>
@ -221,8 +221,7 @@ const copyPasswordResetUrl = async (user: User) => {
<div v-if="!record.roles.includes('super')" class="flex items-center gap-2">
<MdiDeleteOutline class="nc-action-btn cursor-pointer" @click="deleteUser(text)" />
<a-dropdown :trigger="['click']" class="flex" placement="bottomRight"
overlay-class-name="nc-dropdown-user-mgmt">
<a-dropdown :trigger="['click']" class="flex" placement="bottomRight" overlay-class-name="nc-dropdown-user-mgmt">
<div class="flex flex-row items-center">
<a-button type="text" class="!px-0">
<div class="flex flex-row items-center h-[1.2rem]">
@ -233,25 +232,27 @@ const copyPasswordResetUrl = async (user: User) => {
<template #overlay>
<a-menu>
<a-menu-item>
<!-- Resend invite Email -->
<div class="flex flex-row items-center py-3" @click="resendInvite(record)">
<MdiEmailArrowRightOutline class="flex h-[1rem] text-gray-500" />
<div class="text-xs pl-2">{{ $t('activity.resendInvite') }}</div>
</div>
</a-menu-item>
<a-menu-item>
<div class="flex flex-row items-center py-3" @click="copyInviteUrl(record)">
<template v-if="record.invite_token">
<a-menu-item>
<!-- Resend invite Email -->
<div class="flex flex-row items-center py-3" @click="resendInvite(record)">
<MdiEmailArrowRightOutline class="flex h-[1rem] text-gray-500" />
<div class="text-xs pl-2">{{ $t('activity.resendInvite') }}</div>
</div>
</a-menu-item>
<a-menu-item>
<div class="flex flex-row items-center py-3" @click="copyInviteUrl(record)">
<MdiContentCopy class="flex h-[1rem] text-gray-500" />
<div class="text-xs pl-2">{{ $t('activity.copyInviteURL') }}</div>
</div>
</a-menu-item>
</template>
<a-menu-item v-else>
<div class="flex flex-row items-center py-3" @click="copyPasswordResetUrl(record)">
<MdiContentCopy class="flex h-[1rem] text-gray-500" />
<div class="text-xs pl-2">{{ $t('activity.copyInviteURL') }}</div>
<div class="text-xs pl-2">{{ $t('activity.copyPasswordResetURL') }}</div>
</div>
</a-menu-item>
<a-menu-item>
<div class="flex flex-row items-center py-3" @click="copyPasswordResetUrl(record)">
<MdiContentCopy class="flex h-[1rem] text-gray-500" />
<div class="text-xs pl-2">{{ $t('activity.copyPasswordResetURL') }}</div>
</div>
</a-menu-item>
</a-menu>
</template>
</a-dropdown>

1
packages/nc-gui/lang/en.json

@ -351,6 +351,7 @@
"deleteUser": "Remove user from project",
"resendInvite": "Resend invite E-mail",
"copyInviteURL": "Copy invite URL",
"copyPasswordResetURL": "Copy password reset URL",
"newRole": "New role",
"reloadRoles": "Reload roles",
"nextPage": "Next page",

68
packages/nc-gui/pages/admin/index.vue

@ -6,44 +6,44 @@ const selectedTabKeys = computed(() => [$route.params.page])
<template>
<div class="container mx-auto h-full">
<a-layout class=" h-full overflow-y-auto flex">
<a-layout class="h-full overflow-y-auto flex">
<!-- Side tabs -->
<a-layout-sider >
<a-layout-sider>
<div class="pt-4 h-full bg-white">
<a-menu :selected-keys="selectedTabKeys" class="tabs-menu h-full" :open-keys="[]">
<a-menu-item
key="users"
class="group active:(!ring-0) hover:(!bg-primary !bg-opacity-25)"
@click="navigateTo('/admin/users')"
>
<div class="flex items-center space-x-2">
<MdiAccountSupervisorOutline />
<a-menu :selected-keys="selectedTabKeys" class="tabs-menu h-full" :open-keys="[]">
<a-menu-item
key="users"
class="group active:(!ring-0) hover:(!bg-primary !bg-opacity-25)"
@click="navigateTo('/admin/users')"
>
<div class="flex items-center space-x-2">
<MdiAccountSupervisorOutline />
<div class="select-none">User Management</div>
</div>
</a-menu-item>
<a-menu-item
key="tokens"
class="group active:(!ring-0) hover:(!bg-primary !bg-opacity-25)"
@click="navigateTo('/admin/tokens')"
>
<div class="flex items-center space-x-2">
<MdiShieldKeyOutline />
<div class="select-none">User Management</div>
</div>
</a-menu-item>
<a-menu-item
key="tokens"
class="group active:(!ring-0) hover:(!bg-primary !bg-opacity-25)"
@click="navigateTo('/admin/tokens')"
>
<div class="flex items-center space-x-2">
<MdiShieldKeyOutline />
<div class="select-none">Tokens</div>
</div>
</a-menu-item>
<a-menu-item
key="license"
class="group active:(!ring-0) hover:(!bg-primary !bg-opacity-25)"
@click="navigateTo('/admin/license')"
>
<div class="flex items-center space-x-2">
<MdiKeyChainVariant />
<div class="select-none">License</div>
</div>
</a-menu-item>
</a-menu>
<div class="select-none">Tokens</div>
</div>
</a-menu-item>
<a-menu-item
key="license"
class="group active:(!ring-0) hover:(!bg-primary !bg-opacity-25)"
@click="navigateTo('/admin/license')"
>
<div class="flex items-center space-x-2">
<MdiKeyChainVariant />
<div class="select-none">License</div>
</div>
</a-menu-item>
</a-menu>
</div>
</a-layout-sider>

Loading…
Cancel
Save