Interface SecurityService
-
- All Superinterfaces:
com.google.gwt.user.client.rpc.RemoteService
- All Known Implementing Classes:
SecurityServiceImpl
@RemoteServiceRelativePath("security") public interface SecurityService extends com.google.gwt.user.client.rpc.RemoteService
The client side stub for the Security Service. This service gives all needed methods to handle user sessions.
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static class
SecurityService.Instance
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description void
addUserToGroup(long groupId, long userId)
Adds a user to a groupvoid
applyRights(GUIMenu menu)
Applies all security settings to menuGUIValue
changePassword(Long requestorUserId, long userId, String oldPassword, String newPassword, boolean notify)
Changes the password of a uservoid
changeStatus(long userId, boolean enabled)
Changes the status of a uservoid
cloneWorkTimes(long srcUserId, long[] userIds, long[] groupIds)
Clones a work time to a set of other usersvoid
deleteGroup(long groupId)
Deletes a given groupvoid
deleteMenu(long menuId)
Deletes a menu but only if is not a legacy menu (type not 0)void
deleteTrustedDevices(String[] deviceIds)
Deletes a set of trusted devices for the current uservoid
deleteUser(long userId)
Deletes a given userString
generatePassword()
Generates a password using the configured policies.String
generatePassword2(int length, int uppercaseChars, int lowercaseChars, int digits, int specialChars, int maxSequenceSize, int maxOccurrences)
Generates a passwordGUIGroup
getGroup(long groupId)
Loads a given group from the databaseGUIMenu
getMenu(long id, String locale)
Retrieves the specified menuGUIMenu[]
getMenus(long parentId, String locale, boolean enabledOnly)
Retrieves the accessible menus children of a given parentGUISession
getSession(String locale, String sid)
Logs-in a user by an existing session ID (session reuse)GUIUser
getUser(long userId)
Loads a given user from the databaseBoolean
isTrustedDevice(String device)
Check if the saved device ID is trusted for the current uservoid
kill(String sid)
Kill the session with the given sidGUISequence[]
loadBlockedEntities()
Retrieves the list of actually blocked usernames and IPs detected as Brute Force AttackGUISecuritySettings
loadSettings()
Loads security settingsvoid
logout()
Logs out the current uservoid
removeBlockedEntities(long[] id)
Removes blocked entries detected as Brute Force Attackvoid
removeFromGroup(long groupId, long[] userIds)
Removes users from a groupvoid
replicateUsersSettings(long masterUserId, Long[] userIds, boolean gui, boolean groups)
Replicates the settings of a given user to a selection of other usersvoid
resetAvatar(long userId)
Resets tha avatar to the default onevoid
saveAvatar(long userId)
Saves an uploaded image as the user's avatarGUIGroup
saveGroup(GUIGroup group)
Creates or updates a groupGUIUser
saveInterfaceSettings(GUIUser user)
Saves the interface settings onlyGUIMenu
saveMenu(GUIMenu menu, String locale)
Saves a menuvoid
saveMenus(GUIMenu[] menus, String locale)
Saves a set of menusGUIUser
saveProfile(GUIUser user)
Saves the profile data onlyboolean
saveSettings(GUISecuritySettings settings)
Saves security settingsGUIUser
saveUser(GUIUser user, GUIInfo info)
Creates or updates a userGUIUser[]
searchUsers(String username, String groupId)
Searches for usersString
syncGeolocationDB(String key)
Downloads the most recent version of the Geolocation databaseString
trustDevice(String label)
Permanently trusts the current device for the current uservoid
updateDeviceLabel(long deviceId, String label)
Updates the label of a device
-
-
-
Method Detail
-
getSession
GUISession getSession(String locale, String sid)
Logs-in a user by an existing session ID (session reuse)- Parameters:
locale
- the currently used language specificationsid
- the session ID (optional), if not provided it is taken by cookies- Returns:
- session informations
-
changePassword
GUIValue changePassword(Long requestorUserId, long userId, String oldPassword, String newPassword, boolean notify)
Changes the password of a user- Parameters:
requestorUserId
- The user Identifier of the requestoruserId
- The user IdentifieroldPassword
- can be nullnewPassword
- the new passwordnotify
- If the new credentials have to be notified- Returns:
- the error code and message. 0 if all went ok, 1 if the password is incorrect, 2 if the new password cannot be notified, 3 if the password has been already used, otherwise a positive number grater than 3
-
generatePassword
String generatePassword() throws ServerException
Generates a password using the configured policies.- Returns:
- the generated password
- Throws:
ServerException
- error generated in the server application
-
generatePassword2
String generatePassword2(int length, int uppercaseChars, int lowercaseChars, int digits, int specialChars, int maxSequenceSize, int maxOccurrences)
Generates a password- Parameters:
length
- dimension of the passworduppercaseChars
- minimum number of upper case charslowercaseChars
- minimum number of lower case charsdigits
- minimum number of digitsspecialChars
- minimum number of special charsmaxSequenceSize
- maximum size of a sequencemaxOccurrences
- maximum number of occurrences of the same char- Returns:
- the generated password
-
changeStatus
void changeStatus(long userId, boolean enabled) throws ServerException
Changes the status of a user- Parameters:
userId
- The user Identifierenabled
- If the user must be enabled or not- Throws:
ServerException
- error generated in the server application
-
logout
void logout()
Logs out the current user
-
deleteUser
void deleteUser(long userId) throws ServerException
Deletes a given user- Parameters:
userId
- identifier of the user- Throws:
ServerException
- error generated in the server application
-
saveUser
GUIUser saveUser(GUIUser user, GUIInfo info) throws ServerException
Creates or updates a user- Parameters:
user
- the user to saveinfo
- informations about the User Interface- Returns:
- the saved user
- Throws:
ServerException
- error generated in the server application
-
replicateUsersSettings
void replicateUsersSettings(long masterUserId, Long[] userIds, boolean gui, boolean groups) throws ServerException
Replicates the settings of a given user to a selection of other users- Parameters:
masterUserId
- identifier of the user with the settings you want to replicateuserIds
- identifiers of the users to replicate the settings togui
- if the user interface settings must be replicatedgroups
- if the groups must be replicated(the read-only users will not be affected by this flag)- Throws:
ServerException
- error generated in the server application
-
saveProfile
GUIUser saveProfile(GUIUser user) throws ServerException
Saves the profile data only- Parameters:
user
- the user to save- Returns:
- the updated user
- Throws:
ServerException
- error generated in the server application
-
saveInterfaceSettings
GUIUser saveInterfaceSettings(GUIUser user) throws ServerException
Saves the interface settings only- Parameters:
user
- the user to save- Returns:
- the updated user
- Throws:
ServerException
- error generated in the server application
-
getUser
GUIUser getUser(long userId) throws ServerException
Loads a given user from the database- Parameters:
userId
- identifier of the user- Returns:
- the user retrieved from the server application
- Throws:
ServerException
- error generated in the server application
-
getGroup
GUIGroup getGroup(long groupId) throws ServerException
Loads a given group from the database- Parameters:
groupId
- identifier of the group- Returns:
- group retrieved from the server application
- Throws:
ServerException
- error generated in the server application
-
saveGroup
GUIGroup saveGroup(GUIGroup group) throws ServerException
Creates or updates a group- Parameters:
group
- the group to save- Returns:
- the updated group
- Throws:
ServerException
- error generated in the server application
-
deleteGroup
void deleteGroup(long groupId) throws ServerException
Deletes a given group- Parameters:
groupId
- identifier of the group- Throws:
ServerException
- error generated in the server application
-
removeFromGroup
void removeFromGroup(long groupId, long[] userIds) throws ServerException
Removes users from a group- Parameters:
groupId
- identifier of the groupuserIds
- array of user identifiers- Throws:
ServerException
- error generated in the server application
-
addUserToGroup
void addUserToGroup(long groupId, long userId) throws ServerException
Adds a user to a group- Parameters:
groupId
- identifier of the groupuserId
- identifier of the user- Throws:
ServerException
- error generated in the server application
-
saveSettings
boolean saveSettings(GUISecuritySettings settings) throws ServerException
Saves security settings- Parameters:
settings
- settings about security- Returns:
- True if the application has to be restarted
- Throws:
ServerException
- error generated in the server application
-
loadSettings
GUISecuritySettings loadSettings() throws ServerException
Loads security settings- Returns:
- the security settings
- Throws:
ServerException
- error generated in the server application
-
kill
void kill(String sid) throws ServerException
Kill the session with the given sid- Parameters:
sid
- identifier of the session- Throws:
ServerException
- error generated in the server application
-
applyRights
void applyRights(GUIMenu menu) throws ServerException
Applies all security settings to menu- Parameters:
menu
- the menu- Throws:
ServerException
- error generated in the server application
-
getMenu
GUIMenu getMenu(long id, String locale) throws ServerException
Retrieves the specified menu- Parameters:
id
- identifier of the menulocale
- currently selected locale- Returns:
- the menu retrieved from the server application
- Throws:
ServerException
- error generated in the server application
-
getMenus
GUIMenu[] getMenus(long parentId, String locale, boolean enabledOnly) throws ServerException
Retrieves the accessible menus children of a given parent- Parameters:
parentId
- identifier of the parent menulocale
- currently selected localeenabledOnly
- to retrieve just the enabled menus- Returns:
- the accessible children
- Throws:
ServerException
- error generated in the server application
-
saveMenus
void saveMenus(GUIMenu[] menus, String locale) throws ServerException
Saves a set of menus- Parameters:
menus
- the menus to savelocale
- currently selected locale- Throws:
ServerException
- error generated in the server application
-
saveMenu
GUIMenu saveMenu(GUIMenu menu, String locale) throws ServerException
Saves a menu- Parameters:
menu
- the menu to savelocale
- currently selected locale- Returns:
- the saved menu
- Throws:
ServerException
- error generated in the server application
-
deleteMenu
void deleteMenu(long menuId) throws ServerException
Deletes a menu but only if is not a legacy menu (type not 0)- Parameters:
menuId
- the menu to delete- Throws:
ServerException
- error generated in the server application
-
searchUsers
GUIUser[] searchUsers(String username, String groupId) throws ServerException
Searches for users- Parameters:
username
- The username used in the like operator (optional)groupId
- The group ID (optional)- Returns:
- Array of found users
- Throws:
ServerException
- error generated in the server application
-
loadBlockedEntities
GUISequence[] loadBlockedEntities() throws ServerException
Retrieves the list of actually blocked usernames and IPs detected as Brute Force Attack- Returns:
- the array of blocked usernames and IPs
- Throws:
ServerException
- error generated in the server application
-
removeBlockedEntities
void removeBlockedEntities(long[] id) throws ServerException
Removes blocked entries detected as Brute Force Attack- Parameters:
id
- identifiers of entities from the BFA list- Throws:
ServerException
- error generated in the server application
-
trustDevice
String trustDevice(String label) throws ServerException
Permanently trusts the current device for the current user- Parameters:
label
- optional label to assign to the current device- Returns:
- the ID of the trusted device
- Throws:
ServerException
- error generated in the server application
-
updateDeviceLabel
void updateDeviceLabel(long deviceId, String label) throws ServerException
Updates the label of a device- Parameters:
deviceId
- identifier of the device to updatelabel
- label to assign to the current device- Throws:
ServerException
- error generated in the server application
-
isTrustedDevice
Boolean isTrustedDevice(String device) throws ServerException
Check if the saved device ID is trusted for the current user- Parameters:
device
- identifier of the device- Returns:
- if the device is trusted or not
- Throws:
ServerException
- error generated in the server application
-
deleteTrustedDevices
void deleteTrustedDevices(String[] deviceIds) throws ServerException
Deletes a set of trusted devices for the current user- Parameters:
deviceIds
- identifiers of the devices to delete- Throws:
ServerException
- error generated in the server application
-
syncGeolocationDB
String syncGeolocationDB(String key) throws ServerException
Downloads the most recent version of the Geolocation database- Parameters:
key
- the API key- Returns:
- the current database version
- Throws:
ServerException
- error generated in the server application
-
saveAvatar
void saveAvatar(long userId) throws ServerException
Saves an uploaded image as the user's avatar- Parameters:
userId
- Identifier of the user- Throws:
ServerException
- error generated in the server application
-
resetAvatar
void resetAvatar(long userId) throws ServerException
Resets tha avatar to the default one- Parameters:
userId
- Identifier of the user- Throws:
ServerException
- error generated in the server application
-
cloneWorkTimes
void cloneWorkTimes(long srcUserId, long[] userIds, long[] groupIds) throws ServerException
Clones a work time to a set of other users- Parameters:
srcUserId
- identifier of the user with the work time you want to cloneuserIds
- direct ids of users to clone the working time togroupIds
- the groups of users to clone the working time to- Throws:
ServerException
- generic error
-
-