Class Users
java.lang.Object
it.uniroma2.art.semanticturkey.services.STServiceAdapter
it.uniroma2.art.semanticturkey.services.core.Users
- All Implemented Interfaces:
NewerNewStyleService
,STService
-
Nested Class Summary
Nested Classes -
Field Summary
Fields inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
applicationEventPublisher, cfManager, exptManager, stServiceContext
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoid
activateRegisteredUser
(String email, String token) void
addUserFormCustomField
(String field, String description) void
changePassword
(String email, String oldPassword, String newPassword) com.fasterxml.jackson.databind.JsonNode
createUser
(String email, String password, String givenName, String familyName, org.eclipse.rdf4j.model.IRI iri, String address, String affiliation, String url, String avatarUrl, String phone, Collection<String> languageProficiencies, Map<org.eclipse.rdf4j.model.IRI, String> customProperties) Create a new uservoid
deleteUser
(String email) Deletes an usercom.fasterxml.jackson.databind.node.ObjectNode
enableUser
(String email, boolean enabled) Enables or disables the given uservoid
forcePassword
(String email, String password) Allows the admin to force the passwordvoid
forgotPassword
(jakarta.servlet.http.HttpServletRequest request, String email, String vbHostAddress, EmailApplicationContext appCtx) com.fasterxml.jackson.databind.JsonNode
getUser()
If there are no registered users return an empty response; If there is a user logged, returns a user object that is a json representation of the logged user.com.fasterxml.jackson.databind.JsonNode
Returns the optional and the custom fields of the user formlistProjectsBoundToUser
(org.eclipse.rdf4j.model.IRI userIri) com.fasterxml.jackson.databind.JsonNode
Returns the capabilities of the current logged user in according the roles he has in the current projectcom.fasterxml.jackson.databind.JsonNode
Returns all the users registeredcom.fasterxml.jackson.databind.JsonNode
listUsersBoundToProject
(String projectName, Users.UserFilter requiredRoles, Users.UserFilter requiredGroups, Users.UserFilter requiredLanguages) Returns all the users that have at least a role in the given projectcom.fasterxml.jackson.databind.JsonNode
registerUser
(String email, String password, String givenName, String familyName, org.eclipse.rdf4j.model.IRI iri, String address, String affiliation, String url, String avatarUrl, String phone, Collection<String> languageProficiencies, Map<org.eclipse.rdf4j.model.IRI, String> customProperties, String vbHostAddress) void
removeUserFormCustomField
(org.eclipse.rdf4j.model.IRI field) void
resetPassword
(jakarta.servlet.http.HttpServletRequest request, String email, String token, EmailApplicationContext appCtx) void
swapUserFormCustomFields
(org.eclipse.rdf4j.model.IRI field1, org.eclipse.rdf4j.model.IRI field2) com.fasterxml.jackson.databind.node.ObjectNode
updateUserAddress
(String email, String address) Update address of the given user.com.fasterxml.jackson.databind.node.ObjectNode
updateUserAffiliation
(String email, String affiliation) Update gender of the given user.com.fasterxml.jackson.databind.node.ObjectNode
updateUserAvatarUrl
(String email, String avatarUrl) Update avatarUrl of the given user.com.fasterxml.jackson.databind.node.ObjectNode
updateUserCustomField
(String email, org.eclipse.rdf4j.model.IRI property, String value) com.fasterxml.jackson.databind.node.ObjectNode
updateUserEmail
(String email, String newEmail) Update email of the given user.com.fasterxml.jackson.databind.node.ObjectNode
updateUserFamilyName
(String email, String familyName) Update last name of the given user.void
updateUserFormCustomField
(org.eclipse.rdf4j.model.IRI fieldIri, String label, String description) void
updateUserFormOptionalFieldVisibility
(org.eclipse.rdf4j.model.IRI field, boolean visibility) com.fasterxml.jackson.databind.node.ObjectNode
updateUserGivenName
(String email, String givenName) Update first name of the given user.com.fasterxml.jackson.databind.node.ObjectNode
updateUserLanguageProficiencies
(String email, Collection<String> languageProficiencies) Update language proficiencies of the given usercom.fasterxml.jackson.databind.node.ObjectNode
updateUserPhone
(String email, String phone) Update the phone of the given user.com.fasterxml.jackson.databind.node.ObjectNode
updateUserUrl
(String email, String url) Update url of the given user.void
verifyUserEmail
(String email, String token, String vbHostAddress) Methods inherited from class it.uniroma2.art.semanticturkey.services.STServiceAdapter
addValue, checkNotLocallyDefined, createQueryBuilder, generateIRI, generateNatureSPARQLSelectPart, generateNatureSPARQLWherePart, generateResourceWithCustomConstructor, getCodaLexModeForSearchFromLexicalizationModel, getDeleteGraph, getGraphFromNature, getInitializedCodaCore, getManagedConnection, getMetadataGraph, getOptionalProject, getPlatformTransactionManager, getProject, getRepository, getRoleFromNature, getUserNamedGraphs, getWorkingGraph, instantiateSearchStrategy, instantiateSearchStrategy, parseReference, publishResourceDeleted, publishResourceDeleted, removeReifiedValue, retrieveResources, shutDownCodaCore, updateTriplePredicate
-
Constructor Details
-
Users
public Users()
-
-
Method Details
-
getUser
If there are no registered users return an empty response; If there is a user logged, returns a user object that is a json representation of the logged user. If there is no logged user, returns an empty user object- Throws:
UserException
-
listUsers
@STServiceOperation @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'R\')") public com.fasterxml.jackson.databind.JsonNode listUsers()Returns all the users registered- Returns:
-
listUserCapabilities
@STServiceOperation public com.fasterxml.jackson.databind.JsonNode listUserCapabilities() throws RBACExceptionReturns the capabilities of the current logged user in according the roles he has in the current project- Returns:
- Throws:
RBACException
-
listUsersBoundToProject
@STServiceOperation public com.fasterxml.jackson.databind.JsonNode listUsersBoundToProject(String projectName, @Optional @JsonSerialized Users.UserFilter requiredRoles, @Optional @JsonSerialized Users.UserFilter requiredGroups, @Optional @JsonSerialized Users.UserFilter requiredLanguages) throws InvalidProjectNameException, ProjectInexistentException, ProjectAccessException Returns all the users that have at least a role in the given project- Parameters:
projectName
-- Returns:
- Throws:
ProjectAccessException
ProjectInexistentException
InvalidProjectNameException
-
listProjectsBoundToUser
@STServiceOperation @PreAuthorize("@auth.isAdmin()") public List<String> listProjectsBoundToUser(org.eclipse.rdf4j.model.IRI userIri) throws ProjectAccessException, UserException - Throws:
ProjectAccessException
UserException
-
createUser
@PreAuthorize("@auth.isAdmin()") @STServiceOperation(method=POST) public com.fasterxml.jackson.databind.JsonNode createUser(String email, String password, String givenName, String familyName, @Optional org.eclipse.rdf4j.model.IRI iri, @Optional String address, @Optional String affiliation, @Optional String url, @Optional String avatarUrl, @Optional String phone, @Optional Collection<String> languageProficiencies, @Optional Map<org.eclipse.rdf4j.model.IRI, String> customProperties) throws ProjectAccessException, UserException, IOException, InterruptedException, STPropertyUpdateException, STPropertyAccessExceptionCreate a new user- Parameters:
email
- this will be used as idpassword
- password not encoded, it is encoded heregivenName
-familyName
-address
-affiliation
-url
-phone
-- Returns:
- Throws:
ProjectAccessException
UserException
IOException
InterruptedException
STPropertyUpdateException
STPropertyAccessException
-
registerUser
@STServiceOperation(method=POST) public com.fasterxml.jackson.databind.JsonNode registerUser(String email, String password, String givenName, String familyName, @Optional org.eclipse.rdf4j.model.IRI iri, @Optional String address, @Optional String affiliation, @Optional String url, @Optional String avatarUrl, @Optional String phone, @Optional Collection<String> languageProficiencies, @Optional Map<org.eclipse.rdf4j.model.IRI, String> customProperties, @Optional String vbHostAddress) throws ProjectAccessException, UserException, STPropertyUpdateException, IOException, STPropertyAccessException, jakarta.mail.MessagingException, InterruptedException- Parameters:
email
-password
-givenName
-familyName
-iri
-address
-affiliation
-url
-avatarUrl
-phone
-languageProficiencies
-customProperties
-vbHostAddress
- required if it is going to register a "standard" user (not admin) so it needs to send the verification link in the email- Throws:
ProjectAccessException
UserException
STPropertyUpdateException
IOException
STPropertyAccessException
jakarta.mail.MessagingException
InterruptedException
-
verifyUserEmail
@STServiceOperation(method=POST) public void verifyUserEmail(String email, String token, String vbHostAddress) throws UserException, IOException, jakarta.mail.MessagingException, STPropertyAccessException, InterruptedException, STPropertyUpdateException - Throws:
UserException
IOException
jakarta.mail.MessagingException
STPropertyAccessException
InterruptedException
STPropertyUpdateException
-
activateRegisteredUser
@STServiceOperation(method=POST) public void activateRegisteredUser(String email, String token) throws UserException - Throws:
UserException
-
updateUserGivenName
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserGivenName(String email, String givenName) throws UserException Update first name of the given user.- Parameters:
email
-givenName
-- Returns:
- Throws:
IOException
UserException
-
updateUserFamilyName
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserFamilyName(String email, String familyName) throws UserException Update last name of the given user.- Parameters:
email
-familyName
-- Returns:
- Throws:
IOException
UserException
-
updateUserEmail
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserEmail(String email, String newEmail) throws UserException Update email of the given user.- Parameters:
email
-newEmail
-- Returns:
- Throws:
IOException
STPropertyUpdateException
UserException
-
updateUserPhone
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserPhone(String email, @Optional String phone) throws UserException Update the phone of the given user.- Parameters:
email
- email of the userphone
- phone number- Returns:
- Throws:
IOException
UserException
-
updateUserAddress
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserAddress(String email, @Optional String address) throws UserException Update address of the given user.- Parameters:
email
- email of the useraddress
- address- Returns:
- Throws:
IOException
UserException
-
updateUserAffiliation
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserAffiliation(String email, @Optional String affiliation) throws UserException Update gender of the given user.- Parameters:
email
-affiliation
-- Returns:
- Throws:
IOException
UserException
-
updateUserUrl
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserUrl(String email, @Optional String url) throws UserException Update url of the given user.- Parameters:
email
-url
-- Returns:
- Throws:
IOException
UserException
-
updateUserAvatarUrl
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserAvatarUrl(String email, @Optional String avatarUrl) throws UserException Update avatarUrl of the given user.- Parameters:
email
-avatarUrl
-- Returns:
- Throws:
IOException
UserException
-
updateUserLanguageProficiencies
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserLanguageProficiencies(String email, Collection<String> languageProficiencies) throws UserException Update language proficiencies of the given user- Parameters:
email
-languageProficiencies
-- Returns:
- Throws:
IOException
UserException
-
enableUser
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'C\')") public com.fasterxml.jackson.databind.node.ObjectNode enableUser(String email, boolean enabled) throws UserException, ProjectBindingException Enables or disables the given user- Parameters:
email
-enabled
-- Returns:
- Throws:
IOException
ProjectBindingException
UserException
-
deleteUser
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'D\')") public void deleteUser(@RequestParam("email") String email) throws Exception Deletes an user- Parameters:
email
-- Throws:
Exception
-
changePassword
@STServiceOperation(method=POST) @PreAuthorize("@auth.isLoggedUser(#email)") public void changePassword(String email, String oldPassword, String newPassword) throws Exception - Throws:
Exception
-
forcePassword
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void forcePassword(String email, String password) throws Exception Allows the admin to force the password- Parameters:
email
-password
-- Throws:
Exception
-
forgotPassword
@STServiceOperation(method=POST) public void forgotPassword(jakarta.servlet.http.HttpServletRequest request, String email, String vbHostAddress, @Optional EmailApplicationContext appCtx) throws Exception - Throws:
Exception
-
resetPassword
@STServiceOperation(method=POST) public void resetPassword(jakarta.servlet.http.HttpServletRequest request, String email, String token, @Optional EmailApplicationContext appCtx) throws Exception - Throws:
Exception
-
getUserFormFields
Returns the optional and the custom fields of the user form- Returns:
-
updateUserFormOptionalFieldVisibility
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void updateUserFormOptionalFieldVisibility(org.eclipse.rdf4j.model.IRI field, boolean visibility) throws UserException - Throws:
UserException
-
addUserFormCustomField
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void addUserFormCustomField(String field, @Optional String description) throws UserException - Throws:
UserException
-
updateUserFormCustomField
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void updateUserFormCustomField(org.eclipse.rdf4j.model.IRI fieldIri, String label, @Optional String description) throws UserException - Throws:
UserException
-
swapUserFormCustomFields
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void swapUserFormCustomFields(org.eclipse.rdf4j.model.IRI field1, org.eclipse.rdf4j.model.IRI field2) throws UserException - Throws:
UserException
-
removeUserFormCustomField
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAdmin()") public void removeUserFormCustomField(org.eclipse.rdf4j.model.IRI field) throws UserException - Throws:
UserException
-
updateUserCustomField
@STServiceOperation(method=POST) @PreAuthorize("@auth.isAuthorized(\'um(user)\', \'U\') || @auth.isLoggedUser(#email)") public com.fasterxml.jackson.databind.node.ObjectNode updateUserCustomField(String email, org.eclipse.rdf4j.model.IRI property, @Optional String value) throws UserException - Throws:
UserException
-