-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
137 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2023 CERN. | ||
# | ||
# invenio-administration is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
|
||
"""Invenio administration module for user resources.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2023 CERN. | ||
# | ||
# invenio-administration is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
|
||
"""Invenio administration module for user resources.""" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,72 @@ | ||
# -*- coding: utf-8 -*- | ||
# | ||
# Copyright (C) 2023 CERN. | ||
# | ||
# invenio-administration is free software; you can redistribute it and/or | ||
# modify it under the terms of the MIT License; see LICENSE file for more | ||
# details. | ||
|
||
"""Invenio administration users view module.""" | ||
from flask import current_app | ||
from invenio_administration.views.base import ( | ||
AdminResourceDetailView, | ||
AdminResourceListView, | ||
) | ||
from invenio_i18n import lazy_gettext as _ | ||
|
||
|
||
class UsersListView(AdminResourceListView): | ||
"""Configuration for users sets list view.""" | ||
|
||
api_endpoint = "/users" | ||
name = "users" | ||
resource_config = "users_resource" | ||
title = "User management" | ||
menu_label = "Users" | ||
category = "User management" | ||
pid_path = "id" | ||
icon = "exchange" | ||
|
||
display_search = True | ||
display_delete = False | ||
display_edit = False | ||
display_create = False | ||
|
||
item_field_list = { | ||
"username": {"text": _("Username"), "order": 1}, | ||
"email": {"text": _("Email"), "order": 2}, | ||
"created": {"text": _("Created"), "order": 4}, | ||
"updated": {"text": _("Updated"), "order": 5}, | ||
} | ||
|
||
search_config_name = "USERS_RESOURCES_SEARCH" | ||
search_sort_config_name = "USERS_RESOURCES_SORT_OPTIONS" | ||
|
||
@staticmethod | ||
def disabled(): | ||
"""Disable the view on demand.""" | ||
return current_app.config["USERS_RESOURCES_ADMINISTRATION_DISABLED"] | ||
|
||
|
||
class UsersDetailView(AdminResourceDetailView): | ||
"""Configuration for users sets detail view.""" | ||
|
||
url = "/users/<pid_value>" | ||
api_endpoint = "/users/" | ||
search_request_headers = {"Accept": "application/json"} | ||
name = "User details" | ||
resource_config = "users_resource" | ||
title = "User Details" | ||
display_delete = False | ||
display_edit = False | ||
|
||
pid_path = "username" | ||
|
||
item_field_list = { | ||
"username": {"text": _("Username"), "order": 1}, | ||
"email": {"text": _("Email"), "order": 2}, | ||
"created": {"text": _("Created"), "order": 3}, | ||
"updated": {"text": _("Updated"), "order": 4}, | ||
"active": {"bool": _("Active"), "order": 5}, | ||
"confirmed": {"bool": _("Confirmed"), "order": 6}, | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters