public class UserManager
extends java.lang.Object
Modifier and Type | Field and Description |
---|---|
static int |
PERMISSION_ADMIN
Permission type: admin.
|
static int |
PERMISSION_FOLDER_ADD_FOLDER
Permission type: add new folder to an existing folder
|
static int |
PERMISSION_FOLDER_ADD_SURVEY
Permission type: add new survey to an existing folder
|
static int |
PERMISSION_MODIFY
Permission type: modify survey/folder
|
static int |
PERMISSION_READ
Permission type: read survey/folder
|
static int |
PERMISSION_SURVEY_CREATE_REPORT
Permission type: create survey reports
|
static int |
PERMISSION_SURVEY_DELETE_RESPONDENT
Permission type: delete survey respondents
|
static int |
PERMISSION_SURVEY_INVITATION
Permission type: create survey invitations
|
static int |
PERMISSION_SURVEY_VIEW_RESPONDENT
Permission type: view survey respondents
|
Constructor and Description |
---|
UserManager() |
Modifier and Type | Method and Description |
---|---|
static void |
addGroupMember(User user,
long userGroupId,
long userId)
Add a new member to the user group.
|
static User |
createUser(User user,
java.lang.String login,
java.lang.String password,
java.lang.String email,
java.lang.String memo)
Creates a new user
|
static UserGroup |
createUserGroup(User user,
java.lang.String name,
java.lang.String description)
Creates a new user group
|
static void |
deleteAddQuestionLibraryPermission(User user,
long userId)
Deny permission to create question libraries for a user with id
userId . |
static void |
deleteFolderPermission(User user,
long userId,
long folderId,
int permissionType)
Deny folder permission to a user with id
userId . |
static void |
deleteGroupMember(User user,
long userGroupId,
long userId)
Deletes a member from the group.
|
static void |
deleteSurveyPermission(User user,
long userId,
long surveyId,
int permissionType)
Deny survey permission to a user with id
userId . |
static void |
deleteUser(User user,
java.lang.String login)
Deletes a user by login name
|
static void |
deleteUserGroup(User user,
long userGroupId)
Deletes a user group
|
static User |
getUser(java.lang.String login)
Gets the user by login name.
|
static User |
getUser(java.lang.String login,
java.lang.String password)
Gets the user by login name.
|
static User |
getUser(User user,
long userId)
Gets the user by id.
|
static java.util.ArrayList |
getUserList(User user)
Gets all users current user has access to, sorted alphabetic The ArrayList contains ListItems
with the UserId and Login values.
|
static void |
grandFolderPermission(User user,
long userId,
long folderId,
int permissionType)
Grand folder permission to a user.
|
static void |
grandSurveyPermission(User user,
long userId,
long surveyId,
int permissionType)
Grand survey permission to a user.
|
static void |
grantAddQuestionLibraryPermission(User user,
long userId)
Grant permission to create question libraries to a user
|
static void |
grantUserGroupAdminPermission(User user,
long userId,
long userGroupId)
Grant user group admin permission to a user
|
static boolean |
hasFolderPermission(User user,
long userId,
long folderId,
int permissionType)
Return true is user with id
userId has the specified folder permission. |
static boolean |
hasSurveyPermission(User user,
long userId,
long surveyId,
int permissionType)
Return true is user with id
userId has the specified survey permission. |
static boolean |
isSuperUser(User userToCheck)
Check if the user is super user
|
static boolean |
isUniqueLogin(java.lang.String login)
Check if login name is unique
|
static void |
logOutUser(long userId)
Logs out user (if online) with the specified user id
|
static void |
updateUser(User userToUpdate)
Update user information.
|
static void |
updateUserGroup(User user,
UserGroup userGroupToUpdate)
Updates the user group.
|
static boolean |
userExists(long userId)
Checks if the user with the specified user id exists.
|
public static final int PERMISSION_ADMIN
public static final int PERMISSION_FOLDER_ADD_FOLDER
public static final int PERMISSION_FOLDER_ADD_SURVEY
public static final int PERMISSION_MODIFY
public static final int PERMISSION_READ
public static final int PERMISSION_SURVEY_CREATE_REPORT
public static final int PERMISSION_SURVEY_VIEW_RESPONDENT
public static final int PERMISSION_SURVEY_DELETE_RESPONDENT
public static final int PERMISSION_SURVEY_INVITATION
public static User createUser(User user, java.lang.String login, java.lang.String password, java.lang.String email, java.lang.String memo) throws SurveySystemException, SurveySecurityException
user
- User with permission create userslogin
- Login nameSurveySystemException
- Thrown if the user has no permission to fulfill the operationSurveySecurityException
- If an error occurs in the applicationpublic static void deleteUser(User user, java.lang.String login) throws SurveySecurityException, SurveySystemException
user
- User with permission delete userslogin
- Login nameSurveySecurityException
- Thrown if the user has no permission to fulfill the operationSurveySystemException
- If an error occurs in the applicationpublic static UserGroup createUserGroup(User user, java.lang.String name, java.lang.String description) throws SurveySystemException, SurveySecurityException
user
- A user with permission to create user groupsname
- The user group namedescription
- The user group descriptionSurveySystemException
- Thrown if the user has no permission to fulfill the operationSurveySecurityException
- If an error occurs in the applicationpublic static void deleteUserGroup(User user, long userGroupId) throws SurveySecurityException, SurveySystemException
user
- A user with permission to delete user groupsuserGroupId
- The user group idSurveySystemException
- Thrown if the user has no permission to fulfill the operationSurveySecurityException
- If an error occurs in the applicationpublic static boolean isSuperUser(User userToCheck)
user
- public static User getUser(User user, long userId) throws SurveySystemException, SurveySecurityException
userId
- User iduser
- User objectSurveySecurityException
- Thrown if the user has no permission to fulfill the
operationSurveySystemException
- If an error occurs in the applicationpublic static User getUser(java.lang.String login) throws SurveySystemException, SurveySecurityException
SurveySecurityException
will be thrown.login
- Login nameSurveySecurityException
- Thrown if the login doesn't match with the user's login
name.SurveySystemException
- If an error occurs in the applicationpublic static User getUser(java.lang.String login, java.lang.String password) throws SurveySystemException, SurveySecurityException
login
- Login namepassword
- User passwordSurveySecurityException
- Thrown if the login doesn't match with the user's login
name.SurveySystemException
- If an error occurs in the applicationpublic static java.util.ArrayList getUserList(User user) throws SurveySystemException
user
- User objectSurveySystemException
- If an error occurs in the applicationpublic static void deleteFolderPermission(User user, long userId, long folderId, int permissionType) throws SurveySecurityException, SurveySystemException
userId
.user
- User with permission to administer other usersuserId
- User who will be denied the folder permission.folderId
- Folder idpermissionType
- Permission type, one of the following types:
PERMISSION_ADMIN
PERMISSION_READ
PERMISSION_MODIFY
PERMISSION_FOLDER_ADD_FOLDER
PERMISSION_FOLDER_ADD_SURVEY
SurveySystemException
- If an error occurs in the systemSurveySecurityException
- Thrown if the user is not authorized to administer the
user.public static void deleteSurveyPermission(User user, long userId, long surveyId, int permissionType) throws SurveySecurityException, SurveySystemException
userId
.user
- User with permission to administer other usersuserId
- User who will be denied the survey permission.surveyId
- Survey idpermissionType
- Permission type, one of the following types:
PERMISSION_ADMIN
PERMISSION_READ
PERMISSION_MODIFY
PERMISSION_SURVEY_CREATE_REPORT
PERMISSION_SURVEY_DELETE_RESPONDENT
PERMISSION_SURVEY_INVITATION
SurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static void deleteAddQuestionLibraryPermission(User user, long userId) throws SurveySecurityException, SurveySystemException
userId
.user
- User with permission to administer other usersuserId
- User who will be denied the permission to create question librariesSurveySystemException
- If an error occurs in the systemSurveySecurityException
- Thrown if the user is not authorized to administer the
user.public static void grandFolderPermission(User user, long userId, long folderId, int permissionType) throws SurveySecurityException, SurveySystemException
user
- User with permission to administer other usersuserId
- User who will get the permission.folderId
- Folder idpermissionType
- Permission type, one of the following types:
PERMISSION_ADMIN
PERMISSION_READ
PERMISSION_MODIFY
PERMISSION_FOLDER_ADD_FOLDER
PERMISSION_FOLDER_ADD_SURVEY
SurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static void grandSurveyPermission(User user, long userId, long surveyId, int permissionType) throws SurveySecurityException, SurveySystemException
user
- User with permission to administer other usersuserId
- User who will get the permission.surveyId
- Survey idpermissionType
- Permission type, one of the following types:
PERMISSION_ADMIN
PERMISSION_READ
PERMISSION_MODIFY
PERMISSION_SURVEY_CREATE_REPORT
PERMISSION_SURVEY_DELETE_RESPONDENT
PERMISSION_SURVEY_INVITATION
SurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static void grantUserGroupAdminPermission(User user, long userId, long userGroupId) throws SurveySecurityException, SurveySystemException
user
- User with permission to administer other usersuserId
- User who will get the permission.userGroupId
- The user group the user will get permission to manageSurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static void grantAddQuestionLibraryPermission(User user, long userId) throws SurveySecurityException, SurveySystemException
user
- User with permission to administer other usersuserId
- User who will get the permission.SurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static boolean hasFolderPermission(User user, long userId, long folderId, int permissionType) throws SurveySecurityException, SurveySystemException
userId
has the specified folder permission.user
- User with permission to administer other usersuserId
- User to check permission.folderId
- Folder idpermissionType
- Permission type, one of the following types:
PERMISSION_ADMIN
PERMISSION_READ
PERMISSION_MODIFY
PERMISSION_FOLDER_ADD_FOLDER
PERMISSION_FOLDER_ADD_SURVEY
SurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static boolean hasSurveyPermission(User user, long userId, long surveyId, int permissionType) throws SurveySecurityException, SurveySystemException
userId
has the specified survey permission.user
- User with permission to administer other usersuserId
- User to check permission.surveyId
- Survey idpermissionType
- Permission type, one of the following types:
PERMISSION_ADMIN
PERMISSION_READ
PERMISSION_MODIFY
PERMISSION_SURVEY_CREATE_REPORT
PERMISSION_SURVEY_DELETE_RESPONDENT
PERMISSION_SURVEY_INVITATION
SurveySecurityException
- Thrown if the user is not authorized to administer the
user.SurveySystemException
- If an error occurs in the systempublic static boolean isUniqueLogin(java.lang.String login) throws SurveySystemException
login
- Login name to checkSurveySystemException
- If an error occurs in the systempublic static void logOutUser(long userId) throws SurveySystemException
uerId
- SurveySystemException
public static void updateUser(User userToUpdate) throws SurveySystemException
userToUpdate
- Description of the ParameterSurveySystemException
- If an error occurs in the applicationpublic static void updateUserGroup(User user, UserGroup userGroupToUpdate) throws SurveySystemException, SurveySecurityException
user
- A user with permission to create user groupsuserGroupToUpdate
- The user group to updateSurveySystemException
- Thrown if the user has no permission to fulfill the operationSurveySecurityException
- If an error occurs in the applicationpublic static void addGroupMember(User user, long userGroupId, long userId) throws SurveySystemException, SurveySecurityException
user
- A user with permission manage the user group.userGroupId
- User group iduserId
- User id to addSurveySystemException
- Thrown if the user has no permission to fulfill the operationSurveySecurityException
- If an error occurs in the applicationpublic static void deleteGroupMember(User user, long userGroupId, long userId) throws SurveySystemException, SurveySecurityException
user
- A user with permission manage the user group.userGroupId
- User group iduserId
- User id to addSurveySystemException
- Thrown if the user has no permission to fulfill the operationSurveySecurityException
- If an error occurs in the applicationpublic static boolean userExists(long userId) throws SurveySystemException
userId
- The user idSurveySystemException
- if any exception occurs.Built on January 16 2019