Interface SecurityService
- All Known Implementing Classes:
SecurityServiceImpl
public interface SecurityService
- Author:
- Dejan Brkic
-
Method Summary
Modifier and TypeMethodDescriptionintGet all usersorg.springframework.security.core.AuthenticationReturns theAuthenticationfor the current user or null if not user is authenticated.Returns the username of the current user OR NULL if no user is authenticatedgetUserGlobalRoles(long userId, String username) getUserPermissions(String site, String path, List<String> groups) getUserProfile(String user) getUserProfileByGitName(String gitName) Get user by git name.getUserRoles(String site) getUserRoles(String site, String user) getUserRoles(String site, String user, boolean includeGlobal) booleanisSiteAdmin(String username, String site) Check if given user is site adminbooleanisSystemAdmin(String username) Check if given user has system_admin rolebooleanuserExists(String username) Check if user exists
-
Method Details
-
getCurrentUser
String getCurrentUser()Returns the username of the current user OR NULL if no user is authenticated- Returns:
- current user
-
getAuthentication
org.springframework.security.core.Authentication getAuthentication()Returns theAuthenticationfor the current user or null if not user is authenticated.- Returns:
- authentication
-
getUserRoles
-
getUserRoles
-
getUserRoles
-
getUserProfile
-
getUserProfileByGitName
Map<String,Object> getUserProfileByGitName(String gitName) throws ServiceLayerException, UserNotFoundException Get user by git name. Special use case because git stores user as string of first and last name separated by ' '- Parameters:
gitName- first and last name separated with ' '- Returns:
- user
- Throws:
ServiceLayerException- general service errorUserNotFoundException- user not found
-
getUserPermissions
-
getUserPermissions
-
userExists
Check if user exists- Parameters:
username- username- Returns:
- true if user exists
- Throws:
ServiceLayerException- general service error
-
getAllUsersTotal
Get all users- Returns:
- number of all users
- Throws:
ServiceLayerException- general service error
-
isSiteAdmin
Check if given user is site admin- Parameters:
username- usersite- site identifier- Returns:
- true if user belongs to admin group
-
isSystemAdmin
Check if given user has system_admin role- Parameters:
username- user- Returns:
- true if user is system_admin, false otherwise
-
getUserGlobalRoles
List<String> getUserGlobalRoles(long userId, String username) throws ServiceLayerException, UserNotFoundException
-