Package org.wso2.carbon.user.api
Interface AuthorizationManager
public interface AuthorizationManager
-
Method Summary
Modifier and TypeMethodDescriptionvoidauthorizeRole(String roleName, String resourceId, String action) Grants authorizes to a role to perform an action on a resource.voidauthorizeUser(String userName, String resourceId, String action) Deprecated.voidclearResourceAuthorizations(String resourceId) Deletes all granted authorization on a resource.voidclearRoleActionOnAllResources(String roleName, String action) Deletes the role's right to perform the action on all resources.voidclearRoleAuthorization(String roleName) Used when deleting roles.voidclearRoleAuthorization(String roleName, String resourceId, String action) Deletes an already granted authorization of a role.voidclearUserAuthorization(String userName) Deprecated.voidclearUserAuthorization(String userName, String resourceId, String action) Deprecated.voidDeny authorizations to a role to perform an action on a resource.voidDeprecated.String[]getAllowedRolesForResource(String resourceId, String action) Retrieves a list of roles allowed to perform the given action on the resourcedefault String[]getAllowedUIResourcesForRole(String roleName, String permissionRootPath) Returns the complete set of resources allowed for Role.String[]getAllowedUIResourcesForUser(String userName, String permissionRootPath) Returns the complete set of UI resources allowed for User.String[]getDeniedRolesForResource(String resourceId, String action) Retrieves a list of roles that are not allowed to perform the given action on the resourceString[]getExplicitlyAllowedUsersForResource(String resourceId, String action) Deprecated.String[]getExplicitlyDeniedUsersForResource(String resourceId, String action) Deprecated.intThis will get the tenant id associated with the user authorization managerbooleanisRoleAuthorized(String roleName, String resourceId, String action) Checks for role authorization.booleanisUserAuthorized(String userName, String resourceId, String action) Checks for user authorization.voidrefreshAllowedRolesForResource(String resourceId) This method used to refresh the existing resource permissions which cached in the memoryvoidresetPermissionOnUpdateRole(String roleName, String newRoleName) This will reset the permission of the renamed role
-
Method Details
-
isUserAuthorized
boolean isUserAuthorized(String userName, String resourceId, String action) throws UserStoreException Checks for user authorization. Users do not have permissions in future. Only roles can have permissions- Parameters:
userName- The user nameresourceId- Resource Id Stringaction- The action user is trying to perform- Returns:
- Returns true when user is authorized to perform the action on the resource and false otherwise.
- Throws:
UserStoreException
-
isRoleAuthorized
boolean isRoleAuthorized(String roleName, String resourceId, String action) throws UserStoreException Checks for role authorization.- Parameters:
roleName- The role nameresourceId- Resource Id Stringaction- The action the role is trying to perform- Returns:
- Returns true when the role is authorized to perform the action on the resource and false otherwise
- Throws:
UserStoreException
-
getExplicitlyAllowedUsersForResource
String[] getExplicitlyAllowedUsersForResource(String resourceId, String action) throws UserStoreException Deprecated.Retrieves a list of users allowed to perform the given action on the resource- Parameters:
resourceId- Resource Id Stringaction- The action that is allowed to perform- Returns:
- Returns a list of users allowed to perform the given action on the resource
- Throws:
UserStoreException
-
getAllowedRolesForResource
Retrieves a list of roles allowed to perform the given action on the resource- Parameters:
resourceId- Resource Id Stringaction- The action that is allowed to perform- Returns:
- Returns a list of roles allowed to perform the given action on the resource
- Throws:
UserStoreException
-
getDeniedRolesForResource
Retrieves a list of roles that are not allowed to perform the given action on the resource- Parameters:
resourceId- Resource Id Stringaction- The action that is allowed to perform- Returns:
- Returns a list of roles allowed to perform the given action on the resource
- Throws:
UserStoreException
-
getExplicitlyDeniedUsersForResource
String[] getExplicitlyDeniedUsersForResource(String resourceId, String action) throws UserStoreException Deprecated.Retrieves a list of users explicitly denied access to a resource. Users do not have permissions in future. Only roles can have permissions- Parameters:
resourceId- Resource Id Stringaction- The action that is disallowed to perform- Returns:
- Throws:
UserStoreException
-
authorizeUser
Deprecated.Grants authorizations to a user to perform an action on a resource. Users do not have permissions in future. Only roles can have permissions- Parameters:
userName- The user nameresourceId- Resource identification stringaction- The action granted to the user- Throws:
UserStoreException
-
authorizeRole
Grants authorizes to a role to perform an action on a resource.- Parameters:
roleName- The role nameresourceId- Resource identification stringaction- The action granted to the role- Throws:
UserStoreException
-
denyUser
Deprecated.Deny authorizations to a user to perform an action on a resource. Users do not have permissions in future. Only roles can have permissions- Parameters:
userName- The user nameresourceId- Resource identification stringaction- The action granted to the user- Throws:
UserStoreException
-
denyRole
Deny authorizations to a role to perform an action on a resource.- Parameters:
roleName- The role nameresourceId- Resource identification stringaction- The action granted to the role- Throws:
UserStoreException
-
clearUserAuthorization
void clearUserAuthorization(String userName, String resourceId, String action) throws UserStoreException Deprecated.Deletes an already granted authorization of a user. Users do not have permissions in future. Only roles can have permissions- Parameters:
userName- The user nameresourceId- Resource identification stringaction- The action granted- Throws:
UserStoreException
-
clearUserAuthorization
Deprecated.Users do not have permissions in future. Only roles can have permissions- Parameters:
userName- The user name- Throws:
UserStoreException
-
clearRoleAuthorization
void clearRoleAuthorization(String roleName, String resourceId, String action) throws UserStoreException Deletes an already granted authorization of a role.- Parameters:
roleName- The role nameresourceId- Resource identification stringaction- The action granted- Throws:
UserStoreException
-
clearRoleActionOnAllResources
Deletes the role's right to perform the action on all resources.- Parameters:
roleName- The role nameaction- The action granted- Throws:
UserStoreException
-
clearRoleAuthorization
Used when deleting roles.- Parameters:
roleName-- Throws:
UserStoreException
-
clearResourceAuthorizations
Deletes all granted authorization on a resource.- Parameters:
resourceId- Resource identification string- Throws:
UserStoreException
-
getAllowedUIResourcesForUser
String[] getAllowedUIResourcesForUser(String userName, String permissionRootPath) throws UserStoreException Returns the complete set of UI resources allowed for User.- Parameters:
userName-- Returns:
- Throws:
UserStoreException
-
getAllowedUIResourcesForRole
default String[] getAllowedUIResourcesForRole(String roleName, String permissionRootPath) throws UserStoreException Returns the complete set of resources allowed for Role.- Parameters:
roleName-- Returns:
- Throws:
UserStoreException
-
getTenantId
This will get the tenant id associated with the user authorization manager- Returns:
- the tenant id of the authorization manager
- Throws:
UserStoreException- if the operation failed
-
resetPermissionOnUpdateRole
This will reset the permission of the renamed role- Parameters:
roleName- The role namenewRoleName- The new role name- Throws:
UserStoreException
-
refreshAllowedRolesForResource
This method used to refresh the existing resource permissions which cached in the memory- Parameters:
resourceId- resource id path- Throws:
UserStoreException- if something went wrong
-