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übersicht
Konstruktoren -
Methodenübersicht
Modifizierer 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
-
DUUIUserController
public DUUIUserController()
-
-
Methodendetails
-
getDropboxCredentials
Retrieve 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.
-
getMinioCredentials
Retrieve 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.
-
getNextCloudCredentials
Retrieve 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
-
getUserById
public static org.bson.Document getUserById(org.bson.types.ObjectId id) Get a user by id.- Parameter:
id- the user id (as anObjectId).- Gibt zurück:
- a
Documentcontaining the user information.
-
getUserById
Get a user by id. Fields to be included can be specified.- Parameter:
id- the user id (as anObjectId).includeFields- the database fields to include.- Gibt zurück:
- a
Documentcontaining the user information.
-
getUserById
Get a user by id.- Parameter:
id- the user id.- Gibt zurück:
- a
Documentcontaining the user information.
-
getUserById
Get 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.
-
matchApiKey
Check if a user with the given API key exists.- Parameter:
authorization- the API key.- Gibt zurück:
- the user if it exists.
-
matchSession
Check 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.
-
getUserByResetToken
Check 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.
-
insertOne
Create and insert a user into the database. TODO: Move request part toDUUIUsersRequestHandler.- Gibt zurück:
- the created user.
-
insertLabel
Create and insert a user into the database. -
updateLabel
-
deleteLabel
-
getLabels
Get all labels from the database.- Gibt zurück:
- a list of labels.
-
getDriverLabels
Get all labels from the database.- Gibt zurück:
- a list of labels.
-
filterLabelsByDriver
-
deleteOne
Delete a user from the database. TODO: Move request part toDUUIUsersRequestHandler.- Gibt zurück:
- a confirmation message.
-
recoverPassword
Check if an email to reset the user password can be sent.- Gibt zurück:
- a confirmation message.
-
resetPassword
Reset the password of the user and store the new one.- Gibt zurück:
- a confirmation message and the user email.
-
resetPasswordNoToken
Reset the password of the user and store the new one without.- Gibt zurück:
- a confirmation message and the user email.
-
fetchLoginCredentials
Fetch the login credentials for a user by email.- Gibt zurück:
- the email and password of the user for logging into the web interface.
-
updateOne
Update a user given an id and a JSON object with updates.- Gibt zurück:
- the updated user only including the updated and defaults fields.
-
insertNewConnection
Verify and insert new connection details.- Gibt zurück:
- the updated user only including the updated and defaults fields.
-
authorizeUser
Check if the user is authorized.- Gibt zurück:
- the authorized user.
-
fetchUser
Retrieve a user from the database given an id.- Gibt zurück:
- a user from the database.
-
fetchUsers
Retrieve 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.
-
addToWorkerCount
Increment 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.
-
finishDropboxOAuthFromCode
Finish 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).
-
finishGoogleOAuthFromCode
Finish 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).
-
refreshAccessToken
public 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
-
getGoogleSettings
Get the Google OAuth 2.0 settings.- Gibt zurück:
- the client id, client secret and redirect uri.
-
getDropboxAppSettings
Get the Dropbox OAuth 2.0 settings.- Gibt zurück:
- the client id, client secret and redirect uri.
-