Package org.wso2.carbon.user.api
Interface AuthorizationManager
-
public interface AuthorizationManager
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description voidauthorizeRole(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.voiddenyRole(String roleName, String resourceId, String action)Deny authorizations to a role to perform an action on a resource.voiddenyUser(String userName, String resourceId, String action)Deprecated.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.intgetTenantId()This 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 Detail
-
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
String[] getAllowedRolesForResource(String resourceId, String action) throws UserStoreException
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
String[] getDeniedRolesForResource(String resourceId, String action) throws UserStoreException
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
void authorizeUser(String userName, String resourceId, String action) throws UserStoreException
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
void authorizeRole(String roleName, String resourceId, String action) throws UserStoreException
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
void denyUser(String userName, String resourceId, String action) throws UserStoreException
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
void denyRole(String roleName, String resourceId, String action) throws UserStoreException
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
void clearUserAuthorization(String userName) throws UserStoreException
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
void clearRoleActionOnAllResources(String roleName, String action) throws UserStoreException
Deletes the role's right to perform the action on all resources.- Parameters:
roleName- The role nameaction- The action granted- Throws:
UserStoreException
-
clearRoleAuthorization
void clearRoleAuthorization(String roleName) throws UserStoreException
Used when deleting roles.- Parameters:
roleName-- Throws:
UserStoreException
-
clearResourceAuthorizations
void clearResourceAuthorizations(String resourceId) throws UserStoreException
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
int getTenantId() throws UserStoreExceptionThis 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
void resetPermissionOnUpdateRole(String roleName, String newRoleName) throws UserStoreException
This will reset the permission of the renamed role- Parameters:
roleName- The role namenewRoleName- The new role name- Throws:
UserStoreException
-
refreshAllowedRolesForResource
void refreshAllowedRolesForResource(String resourceId) throws UserStoreException
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
-
-