feat: add back toggle admin
This commit is contained in:
@@ -75,7 +75,7 @@ async def api_get_users(
|
||||
summary="Get user by Id",
|
||||
)
|
||||
async def api_get_user(user_id: str) -> User:
|
||||
user = await get_user(user_id)
|
||||
user = await get_user(user_id, activated=None)
|
||||
if not user:
|
||||
raise HTTPException(HTTPStatus.NOT_FOUND, "User not found.")
|
||||
return user
|
||||
@@ -237,7 +237,7 @@ async def api_users_toggle_activated(
|
||||
if user_id == account.id:
|
||||
raise HTTPException(
|
||||
status_code=HTTPStatus.BAD_REQUEST,
|
||||
detail="Users cannot deactivate themselves.",
|
||||
detail="You cannot deactivate yourself.",
|
||||
)
|
||||
|
||||
if settings.is_admin_user(user_id):
|
||||
|
||||
@@ -188,6 +188,8 @@ window.localisation.en = {
|
||||
only_admins_can_create_extensions:
|
||||
'Only admin accounts can create extensions',
|
||||
admin_only: 'Admin Only',
|
||||
make_user_admin: 'Make User Admin',
|
||||
revoke_admin: 'Revoke Admin',
|
||||
new_version: 'New Version',
|
||||
reviews_url: 'Reviews URL',
|
||||
reviews_url_label: 'Reviews server URL',
|
||||
|
||||
@@ -218,6 +218,26 @@
|
||||
:label="$t('update_account')"
|
||||
class="q-ml-md"
|
||||
></q-btn>
|
||||
|
||||
<q-btn
|
||||
v-if="activeUser.data.id"
|
||||
outline
|
||||
color="primary"
|
||||
class="q-ml-md"
|
||||
>
|
||||
<q-toggle
|
||||
size="xs"
|
||||
color="secondary"
|
||||
v-model="activeUser.data.admin"
|
||||
@update:model-value="toggleAdmin(activeUser.data.id)"
|
||||
:label="
|
||||
activeUser.data.admin
|
||||
? $t('revoke_admin')
|
||||
: $t('make_user_admin')
|
||||
"
|
||||
>
|
||||
</q-toggle>
|
||||
</q-btn>
|
||||
<q-btn
|
||||
v-else
|
||||
@click="createUser()"
|
||||
@@ -590,9 +610,9 @@
|
||||
<q-btn
|
||||
@click="showAccountPage(props.row.id)"
|
||||
round
|
||||
icon="edit"
|
||||
:icon="props.row.is_admin ? 'admin_panel_settings' : 'edit'"
|
||||
size="sm"
|
||||
color="secondary"
|
||||
:color="props.row.is_admin ? 'primary' : 'secondary'"
|
||||
class="q-ml-xs"
|
||||
>
|
||||
<q-tooltip>
|
||||
|
||||
Reference in New Issue
Block a user