Klasse DUUIUserController
java.lang.Object
org.texttechnologylab.duui.api.controllers.users.DUUIUserController
A Controller for database operations related to the users collection.
- Autor:
- Cedric Borkowski
- 
KonstruktorübersichtKonstruktoren
- 
MethodenübersichtModifizierer und TypMethodeBeschreibungstatic voidaddToWorkerCount(String id, int count) Increment or decrement (negative count) to the worker count.static StringauthorizeUser(spark.Request request, spark.Response response) Check if the user is authorized.static StringdeleteLabel(spark.Request request, spark.Response response) static StringdeleteOne(spark.Request request, spark.Response response) Delete a user from the database.static StringfetchLoginCredentials(spark.Request request, spark.Response response) Fetch the login credentials for a user by email.static StringfetchUser(spark.Request request, spark.Response response) Retrieve a user from the database given an id.static StringfetchUsers(spark.Request request, spark.Response response) Retrieve multiple users from the database.filterLabelsByDriver(String driver) static StringfinishDropboxOAuthFromCode(spark.Request request, spark.Response response) Finish the Dropbox OAuth 2.0 process given a code returned after accepting the connection with DUUI.static StringfinishGoogleOAuthFromCode(spark.Request request, spark.Response response) Finish the Google OAuth 2.0 process given a code returned after accepting the connection with DUUI.static StringgetDriverLabels(spark.Request request, spark.Response response) Get all labels from the database.static StringgetDropboxAppSettings(spark.Request request, spark.Response response) Get the Dropbox OAuth 2.0 settings.static org.bson.DocumentgetDropboxCredentials(org.bson.Document user, String providerId) Retrieve the stored user credentials for dropbox (access and refresh token).static org.bson.DocumentgetGoogleCredentials(org.bson.Document user, String providerId) static StringgetGoogleSettings(spark.Request request, spark.Response response) Get the Google OAuth 2.0 settings.static StringgetLabels(spark.Request request, spark.Response response) Get all labels from the database.static org.bson.DocumentgetMinioCredentials(org.bson.Document user, String providerId) Retrieve the stored user credentials for minio (endpoint access and secret key).static org.bson.DocumentgetNextCloudCredentials(org.bson.Document user, String providerId) Retrieve the stored user credentials for nextcloud (uri, username and password).static org.bson.DocumentgetUserById(String id) Get a user by id.static org.bson.DocumentgetUserById(String id, List<String> includeFields) Get a user by id.static org.bson.DocumentgetUserById(org.bson.types.ObjectId id) Get a user by id.static org.bson.DocumentgetUserById(org.bson.types.ObjectId id, List<String> includeFields) Get a user by id.static org.bson.DocumentgetUserByResetToken(String token) Check if a user with the given password reset toekn exists.static StringinsertLabel(spark.Request request, spark.Response response) Create and insert a user into the database.static StringinsertNewConnection(spark.Request request, spark.Response response) Verify and insert new connection details.static StringinsertOne(spark.Request request, spark.Response response) Create and insert a user into the database.static org.bson.DocumentmatchApiKey(String authorization) Check if a user with the given API key exists.static org.bson.DocumentmatchSession(String session) Check if a user with the given session id exists.static StringrecoverPassword(spark.Request request, spark.Response response) Check if an email to reset the user password can be sent.static StringrefreshAccessToken(String refreshToken, String clientId, String clientSecret) Refresh the access token for a user given a refresh token.static StringresetPassword(spark.Request request, spark.Response response) Reset the password of the user and store the new one.static StringresetPasswordNoToken(spark.Request request, spark.Response response) Reset the password of the user and store the new one without.static StringupdateLabel(spark.Request request, spark.Response response) static StringupdateOne(spark.Request request, spark.Response response) Update a user given an id and a JSON object with updates.
- 
Konstruktordetails- 
DUUIUserControllerpublic DUUIUserController()
 
- 
- 
Methodendetails- 
getDropboxCredentialsRetrieve the stored user credentials for dropbox (access and refresh token).- Parameter:
- user- The user to retrieve the credentials for.
- Gibt zurück:
- a Documentcontaining the credentials.
 
- 
getMinioCredentialsRetrieve the stored user credentials for minio (endpoint access and secret key).- Parameter:
- user- The user to retrieve the credentials for.
- Gibt zurück:
- a Documentcontaining the credentials.
 
- 
getNextCloudCredentialsRetrieve the stored user credentials for nextcloud (uri, username and password).- Parameter:
- user- The user to retrieve the credentials for.
- Gibt zurück:
- a Documentcontaining the credentials.
 
- 
getGoogleCredentials
- 
getUserByIdpublic static org.bson.Document getUserById(org.bson.types.ObjectId id) Get a user by id.- Parameter:
- id- the user id (as an- ObjectId).
- Gibt zurück:
- a Documentcontaining the user information.
 
- 
getUserByIdGet a user by id. Fields to be included can be specified.- Parameter:
- id- the user id (as an- ObjectId).
- includeFields- the database fields to include.
- Gibt zurück:
- a Documentcontaining the user information.
 
- 
getUserByIdGet a user by id.- Parameter:
- id- the user id.
- Gibt zurück:
- a Documentcontaining the user information.
 
- 
getUserByIdGet a user by id. Fields to be included can be specified.- Parameter:
- id- the user id.
- includeFields- the database fields to include.
- Gibt zurück:
- a Documentcontaining the user information.
 
- 
matchApiKeyCheck if a user with the given API key exists.- Parameter:
- authorization- the API key.
- Gibt zurück:
- the user if it exists.
 
- 
matchSessionCheck if a user with the given session id exists.- Parameter:
- session- the session id from the web interface.
- Gibt zurück:
- the user if it exists.
 
- 
getUserByResetTokenCheck if a user with the given password reset toekn exists.- Parameter:
- token- the password reset token set from resetting the password in the web interface.
- Gibt zurück:
- the user if it exists.
 
- 
insertOneCreate and insert a user into the database. TODO: Move request part toDUUIUsersRequestHandler.- Gibt zurück:
- the created user.
 
- 
insertLabelCreate and insert a user into the database.
- 
updateLabel
- 
deleteLabel
- 
getLabelsGet all labels from the database.- Gibt zurück:
- a list of labels.
 
- 
getDriverLabelsGet all labels from the database.- Gibt zurück:
- a list of labels.
 
- 
filterLabelsByDriver
- 
deleteOneDelete a user from the database. TODO: Move request part toDUUIUsersRequestHandler.- Gibt zurück:
- a confirmation message.
 
- 
recoverPasswordCheck if an email to reset the user password can be sent.- Gibt zurück:
- a confirmation message.
 
- 
resetPasswordReset the password of the user and store the new one.- Gibt zurück:
- a confirmation message and the user email.
 
- 
resetPasswordNoTokenReset the password of the user and store the new one without.- Gibt zurück:
- a confirmation message and the user email.
 
- 
fetchLoginCredentialsFetch the login credentials for a user by email.- Gibt zurück:
- the email and password of the user for logging into the web interface.
 
- 
updateOneUpdate a user given an id and a JSON object with updates.- Gibt zurück:
- the updated user only including the updated and defaults fields.
 
- 
insertNewConnectionVerify and insert new connection details.- Gibt zurück:
- the updated user only including the updated and defaults fields.
 
- 
authorizeUserCheck if the user is authorized.- Gibt zurück:
- the authorized user.
 
- 
fetchUserRetrieve a user from the database given an id.- Gibt zurück:
- a user from the database.
 
- 
fetchUsersRetrieve multiple users from the database. This is only possible for admins and is used to manage roles in the web interface.- Gibt zurück:
- a list of users.
 
- 
addToWorkerCountIncrement or decrement (negative count) to the worker count. Acts as a rate limit for threads.- Parameter:
- id- the user id.
- count- the amount of workers to add or subtract.
 
- 
finishDropboxOAuthFromCodeFinish the Dropbox OAuth 2.0 process given a code returned after accepting the connection with DUUI.- Gibt zurück:
- the user with updated dropbox credentials. See getDropboxCredentials(Document, String).
 
- 
finishGoogleOAuthFromCodeFinish the Google OAuth 2.0 process given a code returned after accepting the connection with DUUI.- Parameter:
- request- the request object.
- response- the response object.
- Gibt zurück:
- the user with updated google credentials. See getGoogleCredentials(Document, String).
 
- 
refreshAccessTokenpublic static String refreshAccessToken(String refreshToken, String clientId, String clientSecret) throws IOException Refresh the access token for a user given a refresh token.- Parameter:
- refreshToken- the refresh token.
- clientId- the client id.
- clientSecret- the client secret.
- Gibt zurück:
- the new access token.
- Löst aus:
- IOException
 
- 
getGoogleSettingsGet the Google OAuth 2.0 settings.- Gibt zurück:
- the client id, client secret and redirect uri.
 
- 
getDropboxAppSettingsGet the Dropbox OAuth 2.0 settings.- Gibt zurück:
- the client id, client secret and redirect uri.
 
 
-