-
Notifications
You must be signed in to change notification settings - Fork 15
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Feature Request: Endpoint for Realm Admins to List and Manage All Tenants #48
Comments
This issue is stale because it has been open for 30 days with no activity. If this issue still applies please comment otherwise it will be closed in 7 days. |
This issue is stale because it has been open for 30 days with no activity. If this issue still applies please comment otherwise it will be closed in 7 days. |
This issue was closed because it has been inactive for 7 days since being marked as stale. |
Realm Role For Tenant AdministrationProblem StatementSystem administrators currently lack a centralized way to view and manage tenants across the system. Proposed Solutionmain...oleaasbo:keycloak-multi-tenancy:realm-admin Code Changes1. Constants Addition// Constants.java
public static final String TENANTS_MANAGEMENT_ROLE = "manage-tenants"; Added new constant to define the realm-wide tenant management role. 2. TenantAdminAuth Extension// TenantAdminAuth.java
boolean isRealmTenantManager() {
return hasAppRole(getRealmManagementClient(), Constants.TENANTS_MANAGEMENT_ROLE);
}
private ClientModel getRealmManagementClient() {
return getRealm().getClientByClientId(org.keycloak.models.Constants.REALM_MANAGEMENT_CLIENT_ID);
} Added methods to:
3. TenantsResource Modification// TenantsResource.java
return tenantProvider.getTenantsStream(realm)
.filter(tenant -> auth.isTenantMember(tenant) || auth.isRealmTenantManager())
.filter(tenant -> search.isEmpty() || tenant.getName().contains(search.get()))
.skip(firstResult)
.limit(maxResults) Modified tenant filtering to:
Implementation Details
Setup RequirementsCreate the
This implementation provides a clean, maintainable solution for realm-wide tenant management while preserving existing functionality and security measures. |
Thanks, @oleaasbo, for the detailed explanation and solution—it looks great! I haven’t had much free time recently to work on this, but your approach seems like a very good fit for what’s needed. If you can, please go ahead and create a PR with your changes, and I’ll review it as soon as possible. If not, I’ll try to make some time next week to add this myself. Thanks again for your work on this! |
Hi @shehabghazy and @oleaasbo , I’ve created PR implementing the tenant management role, based on @oleaasbo’s detailed proposal. I’d greatly appreciate it if you could take a look and share your feedback to ensure it meets your needs. Thank you! |
As a system administrator, there is often a need to view and manage all tenants within the system. This capability is crucial for overseeing tenant status and performing administrative tasks efficiently. Currently, there is no straightforward way to list all tenants from the admin side.
So it would be beneficial to introduce a dedicated endpoint that allows realm admins to list and manage all tenants. This feature would streamline administrative workflows and enhance overall system management.
Additionally it is suggested to Include options for filtering and sorting tenant data to facilitate specific administrative tasks.
This feature would significantly enhance the administrative capabilities of the multi tenancy extension and improve overall workflow efficiency.
The text was updated successfully, but these errors were encountered: