diff --git a/docs/images/account/registered.png b/docs/images/account/registered.png new file mode 100644 index 00000000..ab28528d Binary files /dev/null and b/docs/images/account/registered.png differ diff --git a/docs/institution.rst b/docs/institution.rst index 3cc91ec1..4c31313a 100644 --- a/docs/institution.rst +++ b/docs/institution.rst @@ -5,7 +5,7 @@ The institution section within SEB Server is used to support built-in multi-tena light-weight stand-alone server but with the possibility to separate operation completely within different institutions. .. note:: - If a quick use-case based reference suites you better, just forward to the "Use Cases" section of this chapter + If a quick use-case based reference suites you better, just forward to the "Use Cases" section of this chapter below Only the role of SEB Server administrator and institutional administrator are able to see and use this section. A SEB Server administrator is able to see the whole list of all existing institutions and to create new and maintain every diff --git a/docs/useraccount.rst b/docs/useraccount.rst index 500f2b7b..4c318cd6 100644 --- a/docs/useraccount.rst +++ b/docs/useraccount.rst @@ -4,6 +4,9 @@ User Accounts The user-account section within SEB Server can be used to create new or modify user-accounts for other user or to modify the own user account and changing the password. This section differs most for the different roles in SEB Server. +.. note:: + If a quick use-case based reference suites you better, just forward to the "Use Cases" section of this chapter below + A user account always belongs to one institution and has some basic attributes; - Institution: A combo- or single-selection to choose the institution the user account belongs to. This is mandatory @@ -28,10 +31,59 @@ A user account always belongs to one institution and has some basic attributes; For more information about roles and each role see the section :ref:`roles_and_usecases` By selecting the "User Account" section on the left side menu, a SEB Server administrator will see a list of all user-accounts -of all institution within a SEB Server instance. The filter above the list can be used to search a certain user account. +of all institution within a SEB Server instance. The filter above the list can be used to search a certain user account. Use the: -- Use the "Institution" filter to select a certain institution and show only the user-accounts that belongs to this institution. -- Use the "First Name" filter to search for user-accounts with the given occurrence of text in the First Name. -- Use the "User Name" filter to search for user-accounts with the given occurrence of text in the Username. -- Use the "Mail" filter to find an user-account by e-mail address -- \ No newline at end of file +- "Institution" filter to select a certain institution and show only the user-accounts that belongs to this institution. +- "First Name" filter to search for user-accounts with the given occurrence of text in the First Name. +- "User Name" filter to search for user-accounts with the given occurrence of text in the Username. +- "Mail" filter to find an user-account by e-mail address +- "Status" filter to select the either and see either only active, only inactive or all user-accounts + +.. image:: images/account/list_serveradmin.png + :align: center + :target: https://raw.githubusercontent.com/SafeExamBrowser/seb-server/master/docs/images/account/list_serveradmin.png + +To view all information of a user-account, double-click in a certain user-account entry from the list or select an entry from the list and +use the "View User Account" action on the right action pain. The user account form will be shown in read only mode with all account information. +To edit this user-account use the "Edit User Account" action on the right action pane. To change the password of the user + + +Use Cases +--------- + +**Register as a exam supporter** + +Registering as a new user is possible only within the SEB Server form-registration yet. Since the SEB Server is mainly a service for administrative work, +there is no third party registration and login in place so far. A self-registered user-account has the single role of an +Exam Supporter and since this user-account is not applied to an exiting exam and running, the user is only able to see and edit its own account settings. +Another user with Exam Administrator role can then assign the new user-account to an exam for support and monitoring. Or one other user-account with +Institution Administrator role can edit the new user-account and give it more privileges. + +To register a new user-account follow the steps below + +- Use a Web-Browser and go to the SEB Server login page by entering the SEB Server URL. +- Click the "Register" action on the login page that is shown right after the "Sign In" action. +- The application will show the registration form. See the image below. +- Enter all mandatory account data within the form and use the "Register" action to confirm. +- If there is missing or wrong data, the registration form will highlight the concerned input fields with a red border and information text just below the field. +- If everything is accepted the user-account is created and the application forwards automatically to the login page. +- Sign in with the user credentials to check the account works correctly. + +.. image:: images/overview/register.png + :align: center + :target: https://raw.githubusercontent.com/SafeExamBrowser/seb-server/master/docs/images/overview/register.png + +Once signed in, the user can see all sections for a Exam Administrator as shown in the image below. Because the user is not assigned to any +Exam as a supporter yet, the "Exam Administration" and "Monitoring" sections are empty. The user is only able to change the account settings. + +.. image:: images/account/registered.png + :align: center + :target: https://raw.githubusercontent.com/SafeExamBrowser/seb-server/master/docs/images/account/registered.png + +**Create new user-account** + +**Modify user-account** + +**Change password** + +**Activate / Deactivate user-account \ No newline at end of file diff --git a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java index d1e89e5c..860405d9 100644 --- a/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java +++ b/src/main/java/ch/ethz/seb/sebserver/webservice/servicelayer/dao/impl/UserDAOImpl.java @@ -201,6 +201,7 @@ public class UserDAOImpl implements UserDAO { } checkUniqueUsername(userMod); + checkUniqueMailAddress(userMod); final UserRecord recordToSave = new UserRecord( null, @@ -260,6 +261,7 @@ public class UserDAOImpl implements UserDAO { .map(record -> { checkUniqueUsername(userInfo); + checkUniqueMailAddress(userInfo); final UserRecord newRecord = new UserRecord( record.getId(), @@ -505,4 +507,24 @@ public class UserDAOImpl implements UserDAO { } } + private void checkUniqueMailAddress(final UserAccount userAccount) { + if (StringUtils.isBlank(userAccount.getEmail())) { + return; + } + + // check same username already exists + final Long otherUsersWithSameName = this.userRecordMapper + .countByExample() + .where(UserRecordDynamicSqlSupport.email, isEqualTo(userAccount.getEmail())) + .and(UserRecordDynamicSqlSupport.uuid, isNotEqualToWhenPresent(userAccount.getModelId())) + .build() + .execute(); + + if (otherUsersWithSameName != null && otherUsersWithSameName > 0) { + throw new APIMessageException(APIMessage.fieldValidationError( + Domain.USER.ATTR_EMAIL, + "user:email:email.notunique")); + } + } + } diff --git a/src/main/resources/messages.properties b/src/main/resources/messages.properties index f661c3ca..4c8406f0 100644 --- a/src/main/resources/messages.properties +++ b/src/main/resources/messages.properties @@ -81,6 +81,7 @@ sebserver.form.validation.fieldError.urlSuffix=The URL Suffix must have a size b sebserver.form.validation.fieldError.notNull=This field is mandatory sebserver.form.validation.fieldError.name.notunique=This name is already in use. Please choose another one. sebserver.form.validation.fieldError.username.notunique=This Username is already in use. Please choose another one. +sebserver.form.validation.fieldError.email.notunique=A user-account with this e-mail address already exists. sebserver.form.validation.fieldError.password.wrong=The old password is wrong sebserver.form.validation.fieldError.password.mismatch=The re-typed password doesn't match the new password sebserver.form.validation.fieldError.invalidURL=The input does not match the URL pattern. @@ -138,7 +139,7 @@ sebserver.actionpane.title= ################################ sebserver.institution.list.actions= -sebserver.institution.list.empty=No institution has been found. Please adapt the filter or create a new institution +sebserver.institution.list.empty=No institution can be found. Please adapt the filter or create a new institution sebserver.institution.list.title=Institutions sebserver.institution.list.title.subtitle= sebserver.institution.list.column.name=Name @@ -188,7 +189,7 @@ sebserver.useraccount.role.EXAM_ADMIN.tooltip=An exam administrator has overall sebserver.useraccount.role.EXAM_SUPPORTER=Exam Supporter sebserver.useraccount.role.EXAM_SUPPORTER.tooltip=An exam supporter can only see and edit the own user account
and monitor exams for that he/she was attached by an exam administrator. -sebserver.useraccount.list.empty=No user account has been found. Please adapt the filter or create a new user account +sebserver.useraccount.list.empty=No user account can be found. Please adapt the filter or create a new user account sebserver.useraccount.list.title=User Accounts sebserver.useraccount.list.title.subtitle= sebserver.useraccount.list.column.institution=Institution @@ -260,7 +261,7 @@ sebserver.lmssetup.type.OPEN_EDX=Open edX sebserver.lmssetup.list.actions= sebserver.lmssetup.list.action.no.modify.privilege=No Access: A LMS Setup from other institution cannot be modified. -sebserver.lmssetup.list.empty=No LMS Setup has been found. Please adapt the filter or create a new LMS Setup +sebserver.lmssetup.list.empty=No LMS Setup can be found. Please adapt the filter or create a new LMS Setup sebserver.lmssetup.list.title=Learning Management System Setups sebserver.lmssetup.list.title.subtitle=List of connection settings to the LMS. sebserver.lmssetup.list.column.institution=Institution @@ -282,7 +283,7 @@ sebserver.lmssetup.action.savetest=Test And Save sebserver.lmssetup.action.testsave=Test And Save sebserver.lmssetup.action.test.ok=Successfully connected to the course API sebserver.lmssetup.action.test.tokenRequestError=The API access was denied: {0}
Please check the LMS connection details. -sebserver.lmssetup.action.test.quizRequestError=Unable to request courses or quizzes from the course API of the LMS. {0} +sebserver.lmssetup.action.test.quizRequestError=Unable to request courses or exams from the course API of the LMS. {0} sebserver.lmssetup.action.test.quizRestrictionError=Unable to access course restriction API of the LMS. {0} sebserver.lmssetup.action.test.missingParameter=There is one or more missing connection parameter.
Please check the connection parameter for this LMS Setup sebserver.lmssetup.action.test.unknownError=An unexpected error happened while trying to connect to the LMS course API. {0} @@ -330,7 +331,7 @@ sebserver.quizdiscovery.list.actions= sebserver.quizdiscovery.list.title=LMS Exams sebserver.quizdiscovery.list.title.subtitle=List of exams found in connected LMS. -sebserver.quizdiscovery.list.empty=No LMS exam has been found. Please adapt the filter or create a new LMS Setup +sebserver.quizdiscovery.list.empty=No LMS exam can be found. Please adapt the filter or create a new LMS Setup sebserver.quizdiscovery.list.column.institution=Institution sebserver.quizdiscovery.list.column.institution.tooltip=The institution filter.

Use the filter above to specify the institution.
{0} sebserver.quizdiscovery.list.column.lmssetup=LMS @@ -341,7 +342,7 @@ sebserver.quizdiscovery.list.column.starttime=Start Time {0} sebserver.quizdiscovery.list.column.starttime.tooltip=The start time of the LMS exam.

Use the filter above to set a specific from date.
{0} sebserver.quizdiscovery.list.column.endtime=End Time {0} sebserver.quizdiscovery.list.column.endtime.tooltip=The end time of the LMS exam.

{0} -sebserver.quizdiscovery.info.pleaseSelect=Please select first a Quiz from the list +sebserver.quizdiscovery.info.pleaseSelect=Please select first an LMS exam from the list sebserver.quizdiscovery.action.list=LMS Exam Lookup sebserver.quizdiscovery.action.import=Import as Exam @@ -394,7 +395,7 @@ sebserver.exam.list.column.starttime.tooltip=The start time of the exam.


Use the filter above to set a specific exam type.
{0} -sebserver.exam.list.empty=No Exam has been found. Please adapt the filter or import one from Quiz +sebserver.exam.list.empty=No Exam can be found. Please adapt the filter or import one from LMS sebserver.exam.list.modify.out.dated=Finished exams cannot be modified. sebserver.exam.list.action.no.modify.privilege=No Access: An Exam from other institution cannot be modified. @@ -424,10 +425,10 @@ sebserver.exam.form.title=Exam sebserver.exam.form.title.subtitle= sebserver.exam.form.lmssetup=LMS Setup sebserver.exam.form.lmssetup.tooltip=The LMS setup that defines the LMS of the exam. -sebserver.exam.form.quizid=Quiz Identifier +sebserver.exam.form.quizid=LMS exam Identifier sebserver.exam.form.quizid.tooltip=The identifier that identifies the quiz of the exam on the corresponding LMS -sebserver.exam.form.quizurl=Quiz URL -sebserver.exam.form.quizurl.tooltip=The direct URL link to the quiz/exam on the LMS +sebserver.exam.form.quizurl=LMS exam URL +sebserver.exam.form.quizurl.tooltip=The direct URL link to the LMS exam sebserver.exam.form.name=Name sebserver.exam.form.name.tooltip=The name of the exam.

This name is defined on the corresponding LMS sebserver.exam.form.description=Description @@ -1400,12 +1401,12 @@ sebserver.userlogs.form.message.tooltip=The user activity log message.
This sebserver.userlogs.details.title=User Activity Log Details sebserver.userlogs.info.pleaseSelect=Please select first a User Log from the list sebserver.userlogs.list.actions= -sebserver.userlogs.list.empty=No User activity logs has been found. Please adapt or clear the filter +sebserver.userlogs.list.empty=No User activity logs can be found. Please adapt or clear the filter sebserver.seblogs.list.title=SEB Client Logs sebserver.seblogs.list.actions= -sebserver.seblogs.list.empty=No SEB client logs has been found. Please adapt or clear the filter +sebserver.seblogs.list.empty=No SEB client logs available. Please adapt or clear the filter sebserver.seblogs.info.pleaseSelect=Please select first a SEB client Log from the list sebserver.seblogs.list.column.institution=Institution