Class UsersManager
java.lang.Object
it.uniroma2.art.semanticturkey.user.UsersManager
-
Field Summary
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionstatic void
activateNewRegisteredUser
(String email, String token) static void
static void
addSuperUser
(STUser user) static void
addUserFormCustomField
(String field, String description) static void
Delete the user that have not been verified after 48 hours of the registrationstatic void
deleteUser
(STUser user) Delete the user with the given emailReturns the list of the administrators' emailReturns the adminstatic Collection<File>
Returns the user details files for all the usersstatic Collection<File>
Returns all the user folders under/users/ static STUser
Returns the logged user (if any), otherwise returns nullstatic String
static STUser
getUnverifiedUser
(String email, String token) static STUser
Returns the user with the given email.static STUser
getUser
(org.eclipse.rdf4j.model.IRI iri) Returns the user with the given IRI.static File
getUserFolder
(STUser user) Returns the user folder under/users/ for the given user static UserForm
static boolean
isEmailUsed
(String email) Check if the given email is already usedstatic boolean
isIriUsed
(org.eclipse.rdf4j.model.IRI iri) Check if the given iri is already usedstatic Collection<STUser>
Returns a list of users which email still need to be verified (statusUserStatus.UNVERIFIED
)static Collection<STUser>
Returns a list of all the registered usersstatic void
Loads all the users into the repository Protected since the load should be done just once by AccessControlManager during its initializationstatic void
registerUser
(STUser user) Registers a userstatic void
removeAdmin
(STUser user) static void
removeSuperUser
(STUser user) static void
removeUserFormCustomField
(org.eclipse.rdf4j.model.IRI field) static void
setUserFormOptionalFieldVisibility
(org.eclipse.rdf4j.model.IRI fieldIri, boolean visibility) static void
swapUserFormCustomField
(org.eclipse.rdf4j.model.IRI field1, org.eclipse.rdf4j.model.IRI field2) static void
updateUserAddress
(STUser user, String newValue) Updates the address of the given user and returns it updatedstatic void
updateUserAffiliation
(STUser user, String newValue) Updates the affiliation of the given user and returns it updatedstatic void
updateUserAvatarUrl
(STUser user, String newValue) Updates the url of the given user and returns it updatedstatic STUser
updateUserCustomProperty
(STUser user, org.eclipse.rdf4j.model.IRI property, String value) Updates the value of a custom property of the given user and returns it updatedstatic void
updateUserEmail
(STUser user, String newValue) Updates the email of the given user and returns it updatedstatic void
updateUserFamilyName
(STUser user, String newValue) Updates the last name of the given user and returns it updatedstatic void
updateUserFormCustomField
(org.eclipse.rdf4j.model.IRI fieldIri, String label, String description) static void
updateUserGivenName
(STUser user, String newValue) Updates the first name of the given user and returns it updatedstatic void
updateUserLanguageProficiencies
(STUser user, Collection<String> newValue) Updates the language proficiencies of the given user and returns it updatedstatic void
updateUserPassword
(STUser user, String newPassword) Updates the password of the given user and returns it updatedstatic void
updateUserPhone
(STUser user, String newValue) Updates the phone number of the given user and returns it updatedstatic void
updateUserStatus
(STUser user, UserStatus newValue) Updates the status of the given user and returns it updatestatic void
updateUserUrl
(STUser user, String newValue) Updates the url of the given user and returns it updatedstatic void
verifyUser
(String email, String token)
-
Field Details
-
USERS_DETAILS_FILE_NAME
- See Also:
-
EMAIL_VERIFICATION_EXPIRATION_HOURS
public static final int EMAIL_VERIFICATION_EXPIRATION_HOURS- See Also:
-
-
Constructor Details
-
UsersManager
public UsersManager()
-
-
Method Details
-
loadUsers
public static void loadUsers() throws org.eclipse.rdf4j.rio.RDFParseException, org.eclipse.rdf4j.repository.RepositoryException, IOException, STPropertyAccessExceptionLoads all the users into the repository Protected since the load should be done just once by AccessControlManager during its initialization- Throws:
org.eclipse.rdf4j.rio.RDFParseException
org.eclipse.rdf4j.repository.RepositoryException
IOException
STPropertyAccessException
-
registerUser
Registers a user- Parameters:
user
-- Throws:
UserException
IOException
ProjectAccessException
-
listUsers
Returns a list of all the registered users- Returns:
-
getAdminEmailList
Returns the list of the administrators' email- Returns:
-
getAdminIriSet
-
getSuperUserIriSet
-
getAdminUsers
Returns the admin- Returns:
-
addAdmin
public static void addAdmin(STUser user) throws STPropertyUpdateException, STPropertyAccessException -
removeAdmin
public static void removeAdmin(STUser user) throws STPropertyUpdateException, STPropertyAccessException -
getSuperUsers
-
addSuperUser
public static void addSuperUser(STUser user) throws STPropertyUpdateException, STPropertyAccessException -
removeSuperUser
public static void removeSuperUser(STUser user) throws STPropertyUpdateException, STPropertyAccessException -
getUser
Returns the user with the given email. If no user with the given email exists, throws a UserException- Parameters:
email
-- Returns:
- Throws:
UserException
-
getUser
Returns the user with the given IRI. If no user with the given IRI exists, throws a UserException- Parameters:
iri
-- Returns:
- Throws:
UserException
-
isEmailUsed
Check if the given email is already used- Parameters:
email
-- Returns:
-
isIriUsed
public static boolean isIriUsed(org.eclipse.rdf4j.model.IRI iri) Check if the given iri is already used- Parameters:
iri
-- Returns:
-
deleteUser
public static void deleteUser(STUser user) throws IOException, InterruptedException, STPropertyUpdateException, STPropertyAccessException Delete the user with the given email- Parameters:
user
-- Throws:
IOException
InterruptedException
STPropertyUpdateException
STPropertyAccessException
-
updateUserPassword
Updates the password of the given user and returns it updated- Parameters:
user
-newPassword
-- Throws:
IOException
UserException
-
updateUserGivenName
Updates the first name of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserFamilyName
Updates the last name of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserEmail
Updates the email of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserPhone
Updates the phone number of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserAddress
Updates the address of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserAffiliation
Updates the affiliation of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserUrl
Updates the url of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserAvatarUrl
Updates the url of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserLanguageProficiencies
public static void updateUserLanguageProficiencies(STUser user, Collection<String> newValue) throws UserException Updates the language proficiencies of the given user and returns it updated- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
updateUserStatus
Updates the status of the given user and returns it update- Parameters:
user
-newValue
-- Throws:
IOException
UserException
-
getLoggedUser
Returns the logged user (if any), otherwise returns null- Returns:
-
getLoggedUserSessionId
-
getUserFolder
Returns the user folder under/users/ for the given user - Parameters:
user
-- Returns:
-
getAllUserFolders
Returns all the user folders under/users/ - Returns:
-
getAllUserDetailsFiles
Returns the user details files for all the users- Returns:
-
getUserForm
-
setUserFormOptionalFieldVisibility
public static void setUserFormOptionalFieldVisibility(org.eclipse.rdf4j.model.IRI fieldIri, boolean visibility) throws UserException - Throws:
UserException
-
addUserFormCustomField
- Throws:
UserException
-
updateUserFormCustomField
public static void updateUserFormCustomField(org.eclipse.rdf4j.model.IRI fieldIri, String label, String description) throws UserException - Throws:
UserException
-
removeUserFormCustomField
public static void removeUserFormCustomField(org.eclipse.rdf4j.model.IRI field) throws UserException - Throws:
UserException
-
swapUserFormCustomField
public static void swapUserFormCustomField(org.eclipse.rdf4j.model.IRI field1, org.eclipse.rdf4j.model.IRI field2) throws UserException - Throws:
UserException
-
updateUserCustomProperty
public static STUser updateUserCustomProperty(STUser user, org.eclipse.rdf4j.model.IRI property, String value) throws UserException Updates the value of a custom property of the given user and returns it updated- Parameters:
user
-property
-value
-- Returns:
- Throws:
IOException
UserException
-
listUnverifiedUsers
Returns a list of users which email still need to be verified (statusUserStatus.UNVERIFIED
)- Returns:
-
getUnverifiedUser
-
verifyUser
- Throws:
UserException
-
clearExpiredUnverifiedUser
public static void clearExpiredUnverifiedUser() throws IOException, InterruptedException, STPropertyUpdateException, STPropertyAccessExceptionDelete the user that have not been verified after 48 hours of the registration -
activateNewRegisteredUser
- Throws:
UserException
-