diff --git a/lib/tool_shed/managers/users.py b/lib/tool_shed/managers/users.py index 055aaf1945d1..3514c6e76cf8 100644 --- a/lib/tool_shed/managers/users.py +++ b/lib/tool_shed/managers/users.py @@ -12,7 +12,7 @@ from tool_shed.webapp.model import User from tool_shed_client.schema import ( CreateUserRequest, - User as ApiUser, + UserV2 as ApiUser, ) @@ -58,9 +58,11 @@ def api_create_user(trans: ProvidesUserContext, request: CreateUserRequest) -> A def get_api_user(app: ToolShedApp, user: User) -> ApiUser: + admin = app.config.is_admin_user(user) return ApiUser( id=app.security.encode_id(user.id), username=user.username, + is_admin=admin, ) diff --git a/lib/tool_shed/webapp/api2/users.py b/lib/tool_shed/webapp/api2/users.py index 8873d8b9800f..fefef4e71a7d 100644 --- a/lib/tool_shed/webapp/api2/users.py +++ b/lib/tool_shed/webapp/api2/users.py @@ -34,7 +34,7 @@ from tool_shed.webapp.model import User as SaUser from tool_shed_client.schema import ( CreateUserRequest, - User, + UserV2 as User, ) from . import ( depends, diff --git a/lib/tool_shed/webapp/frontend/src/components/ShedToolbar.vue b/lib/tool_shed/webapp/frontend/src/components/ShedToolbar.vue index 631d2349f8ac..3338c42984c1 100644 --- a/lib/tool_shed/webapp/frontend/src/components/ShedToolbar.vue +++ b/lib/tool_shed/webapp/frontend/src/components/ShedToolbar.vue @@ -8,13 +8,11 @@ defineProps({ required: true, }, }) -// TODO: recover from the API -const ADMINS = ["jmchilton"] const authStore = useAuthStore() void authStore.setup() -const admin = computed(() => authStore.user && ADMINS.indexOf(authStore.user.username) > -1) +const admin = computed(() => authStore.user && authStore.user.is_admin)