Package com.logicaldoc.core.security
Class SecurityManagerImpl
- java.lang.Object
-
- com.logicaldoc.core.security.SecurityManagerImpl
-
- All Implemented Interfaces:
SecurityManager
public class SecurityManagerImpl extends Object implements SecurityManager
Basic implementation ofSecurityManager
- Since:
- 3.0
- Author:
- Marco Meschieri - LogicalDOC
-
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description Set<Group>
getAllowedGroups(long menuId)
Retrieves the collection of groups that can access the given menuSet<Permission>
getEnabledPermissions(long docId, long userId)
Finds all permissions of a user enabled on the specified documentboolean
isDownloadEnabled(long docId, long userId)
boolean
isMemberOf(long userId, long groupId)
Checks if a given user is member of a particular groupboolean
isMemberOf(long userId, String groupName)
Checks if a given user is member of a particular groupboolean
isPermissionEnabled(Permission permission, long docId, long userId)
This method checks if the given permission is enabled for a document and an user.boolean
isPrintEnabled(long docId, long userId)
boolean
isReadEnabled(long docId, long userId)
boolean
isWriteEnabled(long docId, long userId)
This method is looking up for writing rights for a folder and an user.void
setDocumentDAO(DocumentDAO documentDAO)
void
setFolderDAO(FolderDAO folderDAO)
void
setGroupDAO(GroupDAO groupDAO)
void
setMenuDAO(MenuDAO menuDAO)
void
setUserDAO(UserDAO userDAO)
-
-
-
Method Detail
-
setMenuDAO
public void setMenuDAO(MenuDAO menuDAO)
-
setGroupDAO
public void setGroupDAO(GroupDAO groupDAO)
-
setUserDAO
public void setUserDAO(UserDAO userDAO)
-
getAllowedGroups
public Set<Group> getAllowedGroups(long menuId)
Description copied from interface:SecurityManager
Retrieves the collection of groups that can access the given menu- Specified by:
getAllowedGroups
in interfaceSecurityManager
- Parameters:
menuId
- The menu to consider- Returns:
- The collection of allowed groups
-
isMemberOf
public boolean isMemberOf(long userId, long groupId)
Description copied from interface:SecurityManager
Checks if a given user is member of a particular group- Specified by:
isMemberOf
in interfaceSecurityManager
- Parameters:
userId
- The user identifiergroupId
- The group identifier- Returns:
- true only if the user belongs to the group
-
isMemberOf
public boolean isMemberOf(long userId, String groupName)
Description copied from interface:SecurityManager
Checks if a given user is member of a particular group- Specified by:
isMemberOf
in interfaceSecurityManager
- Parameters:
userId
- The user identifiergroupName
- The group name- Returns:
- true only if the user belongs to the group
-
isWriteEnabled
public boolean isWriteEnabled(long docId, long userId) throws PersistenceException
Description copied from interface:SecurityManager
This method is looking up for writing rights for a folder and an user.- Specified by:
isWriteEnabled
in interfaceSecurityManager
- Parameters:
docId
- ID of the documentuserId
- ID of the user- Returns:
- if the user has the write permission on the document
- Throws:
PersistenceException
- error at data layer
-
isReadEnabled
public boolean isReadEnabled(long docId, long userId) throws PersistenceException
- Specified by:
isReadEnabled
in interfaceSecurityManager
- Throws:
PersistenceException
-
isPrintEnabled
public boolean isPrintEnabled(long docId, long userId) throws PersistenceException
- Specified by:
isPrintEnabled
in interfaceSecurityManager
- Throws:
PersistenceException
-
isDownloadEnabled
public boolean isDownloadEnabled(long docId, long userId) throws PersistenceException
- Specified by:
isDownloadEnabled
in interfaceSecurityManager
- Throws:
PersistenceException
-
isPermissionEnabled
public boolean isPermissionEnabled(Permission permission, long docId, long userId) throws PersistenceException
Description copied from interface:SecurityManager
This method checks if the given permission is enabled for a document and an user.- Specified by:
isPermissionEnabled
in interfaceSecurityManager
- Parameters:
permission
- the permission to checkdocId
- ID of the documentuserId
- ID of the user- Returns:
- if the permission is granted to the user on the document
- Throws:
PersistenceException
- error at data layer
-
getEnabledPermissions
public Set<Permission> getEnabledPermissions(long docId, long userId) throws PersistenceException
Description copied from interface:SecurityManager
Finds all permissions of a user enabled on the specified document- Specified by:
getEnabledPermissions
in interfaceSecurityManager
- Parameters:
docId
- ID of the documentuserId
- ID of the user- Returns:
- Collection of permissions granted to the user on the document
- Throws:
PersistenceException
- error at data layer
-
setFolderDAO
public void setFolderDAO(FolderDAO folderDAO)
-
setDocumentDAO
public void setDocumentDAO(DocumentDAO documentDAO)
-
-