dosubot[bot] commented on issue #29505:
URL: https://github.com/apache/superset/issues/29505#issuecomment-2268479456
<!-- Answer -->
To resolve the "Access Denied" error when navigating to `list/users` after
implementing a custom login setup in Apache Superset, ensure that the user has
the necessary permissions to access the "List Users" view. This view is
restricted to admin users only.
Here is the relevant part of the code that defines the permissions:
```python
ADMIN_ONLY_VIEW_MENUS = {
"Access Requests",
"Action Log",
"Log",
"List Users",
"List Roles",
"ResetPasswordView",
"RoleModelView",
"Row Level Security",
"Row Level Security Filters",
"RowLevelSecurityFiltersModelView",
"Security",
"SQL Lab",
"User Registrations",
"User's Statistics",
} | USER_MODEL_VIEWS
```
Ensure that the user has the appropriate admin role. You can do this by
assigning the admin role to the user in Superset:
```python
from superset import app, db
from superset.security.manager import security_manager
with app.app_context():
user = security_manager.find_user(username="your_username")
admin_role = security_manager.find_role("Admin")
user.roles.append(admin_role)
db.session.commit()
```
Replace `"your_username"` with the actual username of the user you want to
grant admin access to. This should resolve the "Access Denied" error when
accessing `list/users`
<sup>[[1]](https://github.com/apache/superset/blob/master/superset/security/manager.py)</sup>.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]
---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]