public class RightProfilesDAO extends AbstractMyBatisDAO implements RequestListener
Modifier and Type | Field and Description |
---|---|
private ThreadLocal<Map<String,Set<String>>> |
_cacheProfilesTL
This cache is for storing the set of profiles a right belongs to.
|
private CurrentUserProvider |
_currentUserProvider |
private ObservationManager |
_observationManager |
private ServiceManager |
_smanager |
static String |
ROLE
The component role.
|
Constructor and Description |
---|
RightProfilesDAO() |
Modifier and Type | Method and Description |
---|---|
private void |
_addRight(SqlSession session,
Profile profile,
String rightId) |
private String |
_generateUniqueId(String label) |
private void |
_notifyEvent(Profile profile,
String eventId) |
void |
addProfile(Profile profile)
Add a new profile
|
void |
addProfile(Profile profile,
boolean silent)
Add a new profile
|
Profile |
addProfile(String label)
Creates a new profile with null context.
|
Profile |
addProfile(String label,
String context)
Creates a new profile.
|
Profile |
addProfile(String id,
String label,
String context)
Creates a new profile
|
void |
addRight(Profile profile,
String rightId)
Add a right to a profile
|
void |
addRights(Profile profile,
List<String> rightIds)
Add a right to a profile
|
void |
deleteProfile(Profile profile)
Delete a profile
|
void |
deleteProfile(Profile profile,
boolean silent)
Delete a profile
|
Profile |
getProfile(String id)
Get the profile with given identifier
|
List<Profile> |
getProfiles()
Get all existing profiles
|
List<Profile> |
getProfiles(String context)
Get the profiles on a given context
|
Set<String> |
getProfilesWithRight(String rightId)
Get all profiles containing the right wth given id
|
List<String> |
getRights(Profile profile)
Get the rights of a profile
|
List<String> |
getRights(String profileId)
Get the rights of a profile
|
void |
removeRights(Profile profile)
Add a right to a profile
|
void |
removeRights(Profile profile,
boolean silent)
Add a right to a profile
|
void |
renameProfile(Profile profile,
String newLabel)
Rename a profile
|
void |
renameProfile(Profile profile,
String newLabel,
boolean silent)
Rename a profile
|
void |
requestEnded(javax.servlet.http.HttpServletRequest req)
Called at the end of the HttpServlet.service() method
|
void |
requestStarted(javax.servlet.http.HttpServletRequest req)
Called at the beginning of the HttpServlet.service() method
|
void |
service(ServiceManager smanager) |
void |
updateRights(Profile profile,
List<String> rights)
Update the rights of a profile
|
void |
updateRights(Profile profile,
List<String> rights,
boolean silent)
Update the rights of a profile
|
configure, contextualize, getSession, getSession, reload, setPluginInfo
getLogger, setLogger
private final ThreadLocal<Map<String,Set<String>>> _cacheProfilesTL
private ServiceManager _smanager
private ObservationManager _observationManager
private CurrentUserProvider _currentUserProvider
public RightProfilesDAO()
public void service(ServiceManager smanager) throws ServiceException
service
in interface Serviceable
service
in class AbstractMyBatisDAO
ServiceException
public List<Profile> getProfiles()
public List<Profile> getProfiles(String context)
context
- The context. Can be null. If null, the profiles with no context are returned.public Profile getProfile(String id)
id
- The id of profile to retrievepublic Set<String> getProfilesWithRight(String rightId)
rightId
- The id of rightpublic Profile addProfile(String label)
label
- The label of profilepublic Profile addProfile(String label, String context)
label
- The label of profilecontext
- The context. Can be nullprivate String _generateUniqueId(String label)
public Profile addProfile(String id, String label, String context)
id
- The unique identifier of profilelabel
- The label of profilecontext
- The context. Can be nullpublic void addProfile(Profile profile, boolean silent)
profile
- The profile to addsilent
- Set to true to not notify observer of this updatepublic void addProfile(Profile profile)
profile
- The profile to addpublic void renameProfile(Profile profile, String newLabel)
profile
- The profile to renamenewLabel
- The updated labelpublic void renameProfile(Profile profile, String newLabel, boolean silent)
profile
- The profile to renamenewLabel
- The updated labelsilent
- Set to true to not notify observer of this updatepublic List<String> getRights(String profileId)
profileId
- The profile idpublic List<String> getRights(Profile profile)
profile
- The profilepublic void addRight(Profile profile, String rightId)
profile
- The profilerightId
- The id of right to addpublic void addRights(Profile profile, List<String> rightIds)
profile
- The profilerightIds
- The id of rights to addpublic void updateRights(Profile profile, List<String> rights)
profile
- The profilerights
- The rights of the profilepublic void updateRights(Profile profile, List<String> rights, boolean silent)
profile
- The profilerights
- The rights of the profilesilent
- Set to true to not notify observer of this updateprivate void _addRight(SqlSession session, Profile profile, String rightId)
public void removeRights(Profile profile)
profile
- The profilepublic void removeRights(Profile profile, boolean silent)
profile
- The profilesilent
- Set to true to not notify observer of this updatepublic void deleteProfile(Profile profile)
profile
- The profile to deletepublic void deleteProfile(Profile profile, boolean silent)
profile
- The profile to deletesilent
- Set to true to not notify observer of this updatepublic void requestStarted(javax.servlet.http.HttpServletRequest req)
RequestListener
requestStarted
in interface RequestListener
req
- the request being processedpublic void requestEnded(javax.servlet.http.HttpServletRequest req)
RequestListener
requestEnded
in interface RequestListener
req
- the processed requestprivate void _notifyEvent(Profile profile, String eventId)