public class JdbcProfileAssignmentStorage extends AbstractMyBatisDAO implements ModifiableProfileAssignmentStorage
ProfileAssignmentStorage
which stores profile assignments in database.
This only supports String objects as contexts.Modifier and Type | Class and Description |
---|---|
private static class |
JdbcProfileAssignmentStorage.Database |
Modifier and Type | Field and Description |
---|---|
protected Map<String,JdbcProfileAssignmentStorage.Database> |
_cache
The jdbc cache
|
protected String |
_supportedContext
The handled context
|
_manager
MAX_PRIORITY, MIN_PRIORITY
Constructor and Description |
---|
JdbcProfileAssignmentStorage() |
Modifier and Type | Method and Description |
---|---|
protected void |
_clearCache()
Clear the cache of _getFullData
|
protected void |
_clearCache(Object context)
Clear the cache of _getFullData
|
protected JdbcProfileAssignmentStorage.Database |
_getFullData(Object context)
Dump the SQL database in an cached object
|
void |
addAllowedGroups(Set<GroupIdentity> groups,
Object object,
String profileId)
Associates some groups with an allowed profile on a given object
|
void |
addAllowedProfilesForAnonymous(Object object,
Set<String> profileIds)
Adds allowed profiles an anonymous user has on the given object
|
void |
addAllowedProfilesForAnyConnectedUser(Object object,
Set<String> profileIds)
Adds allowed profiles any connected user has on the given object
|
void |
addAllowedUsers(Set<UserIdentity> users,
Object object,
String profileId)
Associates some users with an allowed profile on a given object
|
void |
addDeniedGroups(Set<GroupIdentity> groups,
Object object,
String profileId)
Associates some groups with a denied profile on a given object
|
void |
addDeniedProfilesForAnonymous(Object object,
Set<String> profileIds)
Adds denied profiles an anonymous user has on the given object
|
void |
addDeniedProfilesForAnyConnectedUser(Object object,
Set<String> profileIds)
Adds denied profiles any connected user has on the given object
|
void |
addDeniedUsers(Set<UserIdentity> users,
Object object,
String profileId)
Associates some users with a denied profile on a given object
|
void |
configure(Configuration configuration) |
Set<GroupIdentity> |
getAllowedGroups(Object object,
String profileId)
Gets the groups that have the given allowed profile on the given object
|
Set<String> |
getAllowedProfilesForAnonymous(Object object)
Gets the allowed profiles an anonymous user has on the given object
|
Set<String> |
getAllowedProfilesForAnyConnectedUser(Object object)
Gets the allowed profiles any connected user has on the given object
|
Map<GroupIdentity,Set<String>> |
getAllowedProfilesForGroups(Object object)
Gets the groups that have allowed profiles assigned on the given object
|
Set<String> |
getAllowedProfilesForUser(UserIdentity user,
Object object)
Get the allowed profiles assigned on the given object for the given user
|
Map<UserIdentity,Set<String>> |
getAllowedProfilesForUsers(Object object)
Gets the users that have allowed profiles assigned on the given object
|
Set<UserIdentity> |
getAllowedUsers(Object object,
String profileId)
Gets the users that have the given allowed profile on the given object
|
Set<GroupIdentity> |
getDeniedGroups(Object object,
String profileId)
Gets the groups that have the given denied profile on the given object
|
Set<String> |
getDeniedProfilesForAnonymous(Object object)
Gets the denied profiles an anonymous user has on the given object
|
Set<String> |
getDeniedProfilesForAnyConnectedUser(Object object)
Gets the denied profiles any connected user has on the given object
|
Map<GroupIdentity,Set<String>> |
getDeniedProfilesForGroups(Object object)
Gets the groups that have denied profiles assigned on the given object
|
Set<String> |
getDeniedProfilesForUser(UserIdentity user,
Object object)
Get the denied profiles assigned on the given object for the given user
|
Map<UserIdentity,Set<String>> |
getDeniedProfilesForUsers(Object object)
Gets the users that have denied profiles assigned on the given object
|
Set<UserIdentity> |
getDeniedUsers(Object object,
String profileId)
Gets the users that have the given denied profile on the given object
|
protected Object |
getObjectWithPrefix(Object context)
Get the object context with prefix if necessary
|
protected String |
getPrefix()
Get the prefix for object context
|
int |
getPriority()
Returns the priority of this profile storage
The
ProfileAssignmentStorageExtensionPoint will take the profile storage
which supports the object with the highest priority to return the allowed/denied users/groups |
boolean |
hasAnonymousAllowedProfile(Set<? extends Object> rootContexts,
Set<String> profileIds)
Returns true if anonymous user has the allowed profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasAnonymousDeniedProfile(Set<? extends Object> rootContexts,
Set<String> profileIds)
Returns true if anonymous user has the denied profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasAnyConnectedAllowedProfile(Set<? extends Object> rootContexts,
Set<String> profileIds)
Returns true if any connected user has the allowed profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasAnyConnectedDeniedProfile(Set<? extends Object> rootContexts,
Set<String> profileIds)
Returns true if any connected user has the denied profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasGroupAllowedProfile(Set<? extends Object> rootContexts,
GroupIdentity group,
Set<String> profileIds)
Returns true if group has the allowed profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasGroupDeniedProfile(Set<? extends Object> rootContexts,
GroupIdentity group,
Set<String> profileIds)
Returns true if group has the denied profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasUserAllowedProfile(Set<? extends Object> rootContexts,
UserIdentity user,
Set<String> profileIds)
Returns true if user has the allowed profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
hasUserDeniedProfile(Set<? extends Object> rootContexts,
UserIdentity user,
Set<String> profileIds)
Returns true if user has the denied profile for any given root context (or any sub context), given some profiles.
Only supported objects are transmitted |
boolean |
isAnonymousAllowed(Object object,
String profileId)
Returns true if anonymous is allowed with the given profile
|
boolean |
isAnonymousDenied(Object object,
String profileId)
Returns true if anonymous is denied with the given profile
|
boolean |
isAnyConnectedUserAllowed(Object object,
String profileId)
Returns true if any connected user is allowed with the given profile
|
boolean |
isAnyConnectedUserDenied(Object object,
String profileId)
Returns true if any connected user is denied with the given profile
|
boolean |
isRootContextSupported(Object rootContext)
Returns true if this profile storage supports the given object as a root context
i.e.
|
boolean |
isSupported(Object object)
Returns true if this profile storage supports the given object,
i.e.
|
void |
removeAllowedGroups(Set<GroupIdentity> groups,
Object object)
Removes the association between some groups and all allowed profiles on a given object
|
void |
removeAllowedGroups(Set<GroupIdentity> groups,
Object object,
String profileId)
Removes the association between some groups and an allowed profile on a given object
|
void |
removeAllowedProfilesForAnonymous(Object object,
Set<String> profileIds)
Removes allowed profiles an anonymous user has on the given object
|
void |
removeAllowedProfilesForAnyConnectedUser(Object object,
Set<String> profileIds)
Removes allowed profiles any connected user has on the given object
|
void |
removeAllowedUsers(Set<UserIdentity> users,
Object object)
Removes the association between some users and all allowed profiles on a given object
|
void |
removeAllowedUsers(Set<UserIdentity> users,
Object object,
String profileId)
Removes the association between some users and an allowed profile on a given object
|
void |
removeDeniedGroups(Set<GroupIdentity> groups,
Object object)
Removes the association between some groups and all denied profiles on a given object
|
void |
removeDeniedGroups(Set<GroupIdentity> groups,
Object object,
String profileId)
Removes the association between some groups and a denied profile on a given object
|
void |
removeDeniedProfilesForAnonymous(Object object,
Set<String> profileIds)
Removes denied profiles an anonymous user has on the given object
|
void |
removeDeniedProfilesForAnyConnectedUser(Object object,
Set<String> profileIds)
Removes denied profiles any connected user has on the given object
|
void |
removeDeniedUsers(Set<UserIdentity> users,
Object object)
Removes the association between some users and all denied profiles on a given object
|
void |
removeDeniedUsers(Set<UserIdentity> users,
Object object,
String profileId)
Removes the association between some users and an denied profile on a given object
|
void |
removeGroup(GroupIdentity group)
Removes all the assignments involving this group
|
void |
removeProfile(String profileId)
Removes all the assignments between this profile and users/groups/anonymous/any connected
|
void |
removeUser(UserIdentity user)
Removes all the assignments involving this user
|
_configureDatasource, _getDataSourceId, _getMyBatisConfiguration, contextualize, getSession, getSession, reload, service, setPluginInfo
getLogger, setLogger
protected final Map<String,JdbcProfileAssignmentStorage.Database> _cache
protected String _supportedContext
public JdbcProfileAssignmentStorage()
public void configure(Configuration configuration) throws ConfigurationException
configure
in interface Configurable
configure
in class AbstractMyBatisDAO
ConfigurationException
protected JdbcProfileAssignmentStorage.Database _getFullData(Object context)
context
- The context to seekprotected void _clearCache()
protected void _clearCache(Object context)
context
- The context to seekprotected Object getObjectWithPrefix(Object context)
context
- The context objectprotected String getPrefix()
public boolean hasUserDeniedProfile(Set<? extends Object> rootContexts, UserIdentity user, Set<String> profileIds)
ProfileAssignmentStorage
hasUserDeniedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights foruser
- The user to testprofileIds
- The ids of the profilespublic boolean hasUserAllowedProfile(Set<? extends Object> rootContexts, UserIdentity user, Set<String> profileIds)
ProfileAssignmentStorage
hasUserAllowedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights foruser
- The user to testprofileIds
- The ids of the profilespublic boolean hasGroupDeniedProfile(Set<? extends Object> rootContexts, GroupIdentity group, Set<String> profileIds)
ProfileAssignmentStorage
hasGroupDeniedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights forgroup
- The group to testprofileIds
- The ids of the profilespublic boolean hasGroupAllowedProfile(Set<? extends Object> rootContexts, GroupIdentity group, Set<String> profileIds)
ProfileAssignmentStorage
hasGroupAllowedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights forgroup
- The group to testprofileIds
- The ids of the profilespublic boolean hasAnyConnectedDeniedProfile(Set<? extends Object> rootContexts, Set<String> profileIds)
ProfileAssignmentStorage
hasAnyConnectedDeniedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights forprofileIds
- The ids of the profilespublic boolean hasAnyConnectedAllowedProfile(Set<? extends Object> rootContexts, Set<String> profileIds)
ProfileAssignmentStorage
hasAnyConnectedAllowedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights forprofileIds
- The ids of the profilespublic boolean hasAnonymousDeniedProfile(Set<? extends Object> rootContexts, Set<String> profileIds)
ProfileAssignmentStorage
hasAnonymousDeniedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights forprofileIds
- The ids of the profilespublic boolean hasAnonymousAllowedProfile(Set<? extends Object> rootContexts, Set<String> profileIds)
ProfileAssignmentStorage
hasAnonymousAllowedProfile
in interface ProfileAssignmentStorage
rootContexts
- The root contexts to search rights forprofileIds
- The ids of the profilespublic Set<String> getAllowedProfilesForAnyConnectedUser(Object object)
ProfileAssignmentStorage
getAllowedProfilesForAnyConnectedUser
in interface ProfileAssignmentStorage
object
- The objectpublic boolean isAnyConnectedUserAllowed(Object object, String profileId)
ProfileAssignmentStorage
isAnyConnectedUserAllowed
in interface ProfileAssignmentStorage
object
- The objectprofileId
- The id of the profilepublic void addAllowedProfilesForAnyConnectedUser(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
addAllowedProfilesForAnyConnectedUser
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to addpublic void removeAllowedProfilesForAnyConnectedUser(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
removeAllowedProfilesForAnyConnectedUser
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to removepublic Set<String> getDeniedProfilesForAnyConnectedUser(Object object)
ProfileAssignmentStorage
getDeniedProfilesForAnyConnectedUser
in interface ProfileAssignmentStorage
object
- The objectpublic boolean isAnyConnectedUserDenied(Object object, String profileId)
ProfileAssignmentStorage
isAnyConnectedUserDenied
in interface ProfileAssignmentStorage
object
- The objectprofileId
- The id of the profilepublic void addDeniedProfilesForAnyConnectedUser(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
addDeniedProfilesForAnyConnectedUser
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to addpublic void removeDeniedProfilesForAnyConnectedUser(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
removeDeniedProfilesForAnyConnectedUser
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to removepublic Set<String> getAllowedProfilesForAnonymous(Object object)
ProfileAssignmentStorage
getAllowedProfilesForAnonymous
in interface ProfileAssignmentStorage
object
- The objectpublic boolean isAnonymousAllowed(Object object, String profileId)
ProfileAssignmentStorage
isAnonymousAllowed
in interface ProfileAssignmentStorage
object
- The objectprofileId
- The id of the profilepublic void addAllowedProfilesForAnonymous(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
addAllowedProfilesForAnonymous
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to addpublic void removeAllowedProfilesForAnonymous(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
removeAllowedProfilesForAnonymous
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to removepublic Set<String> getDeniedProfilesForAnonymous(Object object)
ProfileAssignmentStorage
getDeniedProfilesForAnonymous
in interface ProfileAssignmentStorage
object
- The objectpublic boolean isAnonymousDenied(Object object, String profileId)
ProfileAssignmentStorage
isAnonymousDenied
in interface ProfileAssignmentStorage
object
- The objectprofileId
- The id of the profilepublic void addDeniedProfilesForAnonymous(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
addDeniedProfilesForAnonymous
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to addpublic void removeDeniedProfilesForAnonymous(Object object, Set<String> profileIds)
ModifiableProfileAssignmentStorage
removeDeniedProfilesForAnonymous
in interface ModifiableProfileAssignmentStorage
object
- The objectprofileIds
- The profiles to removepublic Set<String> getAllowedProfilesForUser(UserIdentity user, Object object)
ProfileAssignmentStorage
getAllowedProfilesForUser
in interface ProfileAssignmentStorage
user
- The userobject
- The object to testpublic Map<UserIdentity,Set<String>> getAllowedProfilesForUsers(Object object)
ProfileAssignmentStorage
getAllowedProfilesForUsers
in interface ProfileAssignmentStorage
object
- The object to testpublic Set<UserIdentity> getAllowedUsers(Object object, String profileId)
ProfileAssignmentStorage
getAllowedUsers
in interface ProfileAssignmentStorage
object
- The object to testprofileId
- The id of the profilepublic void addAllowedUsers(Set<UserIdentity> users, Object object, String profileId)
ModifiableProfileAssignmentStorage
addAllowedUsers
in interface ModifiableProfileAssignmentStorage
users
- The users to addobject
- The objectprofileId
- The id of the profilepublic void removeAllowedUsers(Set<UserIdentity> users, Object object, String profileId)
ModifiableProfileAssignmentStorage
removeAllowedUsers
in interface ModifiableProfileAssignmentStorage
users
- The users to removeobject
- The objectprofileId
- The id of the profilepublic void removeAllowedUsers(Set<UserIdentity> users, Object object)
ModifiableProfileAssignmentStorage
removeAllowedUsers
in interface ModifiableProfileAssignmentStorage
users
- The users to removeobject
- The objectpublic Map<GroupIdentity,Set<String>> getAllowedProfilesForGroups(Object object)
ProfileAssignmentStorage
getAllowedProfilesForGroups
in interface ProfileAssignmentStorage
object
- The object to testpublic Set<GroupIdentity> getAllowedGroups(Object object, String profileId)
ProfileAssignmentStorage
getAllowedGroups
in interface ProfileAssignmentStorage
object
- The object to testprofileId
- The id of the profilepublic void addAllowedGroups(Set<GroupIdentity> groups, Object object, String profileId)
ModifiableProfileAssignmentStorage
addAllowedGroups
in interface ModifiableProfileAssignmentStorage
groups
- The groups to addobject
- The objectprofileId
- The id of the profilepublic void removeAllowedGroups(Set<GroupIdentity> groups, Object object, String profileId)
ModifiableProfileAssignmentStorage
removeAllowedGroups
in interface ModifiableProfileAssignmentStorage
groups
- The groups to removeobject
- The objectprofileId
- The id of the profilepublic void removeAllowedGroups(Set<GroupIdentity> groups, Object object)
ModifiableProfileAssignmentStorage
removeAllowedGroups
in interface ModifiableProfileAssignmentStorage
groups
- The groups to removeobject
- The objectpublic Set<String> getDeniedProfilesForUser(UserIdentity user, Object object)
ProfileAssignmentStorage
getDeniedProfilesForUser
in interface ProfileAssignmentStorage
user
- The userobject
- The object to testpublic Map<UserIdentity,Set<String>> getDeniedProfilesForUsers(Object object)
ProfileAssignmentStorage
getDeniedProfilesForUsers
in interface ProfileAssignmentStorage
object
- The object to testpublic Set<UserIdentity> getDeniedUsers(Object object, String profileId)
ProfileAssignmentStorage
getDeniedUsers
in interface ProfileAssignmentStorage
object
- The object to testprofileId
- The id of the profilepublic void addDeniedUsers(Set<UserIdentity> users, Object object, String profileId)
ModifiableProfileAssignmentStorage
addDeniedUsers
in interface ModifiableProfileAssignmentStorage
users
- The users to addobject
- The objectprofileId
- The id of the profilepublic void removeDeniedUsers(Set<UserIdentity> users, Object object, String profileId)
ModifiableProfileAssignmentStorage
removeDeniedUsers
in interface ModifiableProfileAssignmentStorage
users
- The users to removeobject
- The objectprofileId
- The id of the profilepublic void removeDeniedUsers(Set<UserIdentity> users, Object object)
ModifiableProfileAssignmentStorage
removeDeniedUsers
in interface ModifiableProfileAssignmentStorage
users
- The users to removeobject
- The objectpublic Map<GroupIdentity,Set<String>> getDeniedProfilesForGroups(Object object)
ProfileAssignmentStorage
getDeniedProfilesForGroups
in interface ProfileAssignmentStorage
object
- The object to testpublic Set<GroupIdentity> getDeniedGroups(Object object, String profileId)
ProfileAssignmentStorage
getDeniedGroups
in interface ProfileAssignmentStorage
object
- The object to testprofileId
- The id of the profilepublic void addDeniedGroups(Set<GroupIdentity> groups, Object object, String profileId)
ModifiableProfileAssignmentStorage
addDeniedGroups
in interface ModifiableProfileAssignmentStorage
groups
- The groups to addobject
- The objectprofileId
- The id of the profilepublic void removeDeniedGroups(Set<GroupIdentity> groups, Object object, String profileId)
ModifiableProfileAssignmentStorage
removeDeniedGroups
in interface ModifiableProfileAssignmentStorage
groups
- The groups to removeobject
- The objectprofileId
- The id of the profilepublic void removeDeniedGroups(Set<GroupIdentity> groups, Object object)
ModifiableProfileAssignmentStorage
removeDeniedGroups
in interface ModifiableProfileAssignmentStorage
groups
- The groups to removeobject
- The objectpublic void removeProfile(String profileId)
ModifiableProfileAssignmentStorage
removeProfile
in interface ModifiableProfileAssignmentStorage
profileId
- The profile to removepublic void removeUser(UserIdentity user)
ModifiableProfileAssignmentStorage
removeUser
in interface ModifiableProfileAssignmentStorage
user
- The userpublic void removeGroup(GroupIdentity group)
ModifiableProfileAssignmentStorage
removeGroup
in interface ModifiableProfileAssignmentStorage
group
- The grouppublic boolean isSupported(Object object)
ProfileAssignmentStorage
isSupported
in interface ProfileAssignmentStorage
object
- The object to testpublic boolean isRootContextSupported(Object rootContext)
ProfileAssignmentStorage
isRootContextSupported
in interface ProfileAssignmentStorage
rootContext
- The object to start searchingpublic int getPriority()
ProfileAssignmentStorage
ProfileAssignmentStorageExtensionPoint
will take the profile storage
which supports the object with the highest priority to return the allowed/denied users/groupsgetPriority
in interface ProfileAssignmentStorage