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