Package mops.businesslogic.security
Class SecurityServiceImpl
- java.lang.Object
-
- mops.businesslogic.security.SecurityServiceImpl
-
- All Implemented Interfaces:
SecurityService
@Service public class SecurityServiceImpl extends java.lang.Object implements SecurityService
Checks roles permissions.
-
-
Constructor Summary
Constructors Constructor Description SecurityServiceImpl(GroupService groupService, PermissionService permissionService)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcheckDeletePermission(Account account, Directory directory)Checks if the user has deleting rights.voidcheckIfRole(Account account, long groupId, java.lang.String allowedRole)Checks if user is has a role.voidcheckReadPermission(Account account, Directory directory)Checks if the user has reading rights.voidcheckWritePermission(Account account, Directory directory)Checks if the user has writing rights.UserPermissiongetPermissionsOfUser(Account account, Directory directory)Gets all 3 permissions of a user in a directory.java.lang.StringgetUserRole(long groupId, Account account)Get the role of a given user in a group.booleanisUserAdmin(Account account, long groupId)Checks if user is has the admin role.
-
-
-
Constructor Detail
-
SecurityServiceImpl
public SecurityServiceImpl(GroupService groupService, PermissionService permissionService)
-
-
Method Detail
-
getPermissionsOfUser
public UserPermission getPermissionsOfUser(Account account, Directory directory) throws MopsException
Gets all 3 permissions of a user in a directory.- Specified by:
getPermissionsOfUserin interfaceSecurityService- Parameters:
account- user credentialsdirectory- the directory- Returns:
- a permission flag object
- Throws:
MopsException
-
checkWritePermission
public void checkWritePermission(Account account, Directory directory) throws MopsException
Checks if the user has writing rights.- Specified by:
checkWritePermissionin interfaceSecurityService- Parameters:
account- user credentialsdirectory- id of the directory to check- Throws:
MopsException- checked exception to present to UI
-
checkReadPermission
public void checkReadPermission(Account account, Directory directory) throws MopsException
Checks if the user has reading rights.- Specified by:
checkReadPermissionin interfaceSecurityService- Parameters:
account- user credentialsdirectory- id of the directory to check- Throws:
MopsException- checked exception to present to UI
-
checkDeletePermission
public void checkDeletePermission(Account account, Directory directory) throws MopsException
Checks if the user has deleting rights.- Specified by:
checkDeletePermissionin interfaceSecurityService- Parameters:
account- user credentialsdirectory- id of the directory to check- Throws:
MopsException- checked exception to present to UI
-
isUserAdmin
public boolean isUserAdmin(Account account, long groupId) throws MopsException
Checks if user is has the admin role.- Specified by:
isUserAdminin interfaceSecurityService- Parameters:
account- user credentialsgroupId- id of the group to check- Returns:
- true if admin
- Throws:
MopsException
-
checkIfRole
public void checkIfRole(Account account, long groupId, java.lang.String allowedRole) throws MopsException
Checks if user is has a role.- Specified by:
checkIfRolein interfaceSecurityService- Parameters:
account- user credentialsgroupId- id of the group to checkallowedRole- role which has the right- Throws:
MopsException- checked exception to present to UI
-
getUserRole
public java.lang.String getUserRole(long groupId, Account account) throws MopsExceptionGet the role of a given user in a group.- Specified by:
getUserRolein interfaceSecurityService- Parameters:
groupId- group to checkaccount- given user- Returns:
- user role
- Throws:
MopsException
-
-