CSC/ECE 517 Fall 2017/E17A6 Fix account creation over web to work reasonably
Introduction to Expertiza
Expertiza[1] is a project developed using Ruby on Rails[2]. It provides features like peer review, team assignments and submission of projects. This can be achieved by submitting code base, URL of hosted code on remote server and Wiki submissions. It is an open source application and the code can be cloned from GitHub[3]. This application provides an efficient way to manage assignments, grades and reviews. This makes the process easier and faster when the class strength is large.
Introduction
Purpose
Expertiza provide the function for user to request an account, but the function is not perfect. The goal of our project is to improve this feature. It will enable Expertiza to handle the pending request for super-admin and add institution for user.
Problem Definition
New user request page
- Currently, a new user can only choose institution from the dropdown. The new user should be able to add a new institution.
- A place where a new user to write a brief introduction is needed in this page.
- Also, in models/requested_user.rb, there are some validations, such as validate email address. It will be better to update the flash message on the view when validation fails.
Super-admin and admin are able to approve or decline new user requests.
- Currently, you have to go to /users/list_pending_requested this url to access a list of pending requests. It will be better to add an option in “Administration > Show…” menu
- Make “Email Address” column in /users/list_pending_requested page clickable. So that super-admin or admin could converse with requesters by clicking email addresses directly.
After approving
- After super-admin or admin approves the request, make sure the record does not disappear on the page. And there should be an email send to email address offered by requester.
Requirements
- Modify the test of request new user method.
- Add a new option for the drop-down bar of institution in the new user request page.
- Add a new textarea in the new user request page, to input a new institution and introduction.
- Add validation for new institution new institutions and introductions.
- Add flash message for requested_user.rb.
- Add a new button on the layout.
- Modify the layout of /users/list_pending_requested page.
- Enable the system will send an email after the request is processed.
Database Design
- The above tables is the original table for this project, however it lacks a column for introduction. So we need to add a new column for request_user table. The new table will be shown below.
Use Cases
- Name: Instructor or Teaching Assistant request a new account
- Actor: Instructor or Teaching Assistant
- Other Participants: None
- Precondition: None
- Primary Sequence:
- 1. Click on “Request account”.
- 2. Select a role.
- 3. Fill in a user name.
- 4. Fill in a full name.
- 5. Fill in an email address.
- 6. Select an institution.
- 7. Fill in the introduction field.
- 8. Click on “Request”.
- Alternative Flow:
- 1. If the institution not in the list, click on “Others”.
- 2. Fill in the institution name.
- Name: Admin or Super admin view list of new account requests
- Actor: Admin or Super admin
- Other Participants: None
- Precondition: Instructor or Teaching Assistant has requested a new account
- Primary Sequence:
- 1. Log in to Expertiza.
- 2. Click on the link “/users/list_pending_requested”.
- 3. View the list of new account requests.
- Alternative Flow: None
- Name: Admin or Super admin accept a new account request
- Actor: Admin or Super admin
- Other Participants: None
- Precondition: Instructor or Teaching Assistant has requested a new account
- Primary Sequence:
- 1. Log in to Expertiza.
- 2. Click on the link “/users/list_pending_requested”.
- 3. Select a request.
- 4. Click on “Accept”.
- 5. Click on “Submit”.
- Alternative Flow: None
- Name: Admin or Super admin reject a new account request
- Actor: Admin or Super admin
- Other Participants: None
- Precondition: Instructor or Teaching Assistant has requested a new account
- Primary Sequence:
- 1. Log in to Expertiza
- 2. Click on the link “/users/list_pending_requested”.
- 3. Select a request.
- 4. Click on “Reject”.
- 5. Click on “Submit”.
- Alternative Flow: None
- Name: Admin or Super admin send an email to applicant
- Actor: Admin or Super admin
- Other Participants: None
- Precondition: Instructor or Teaching Assistant has requested a new account
- Primary Sequence:
- 1. Log in to Expertiza
- 2. Click on the link “/users/list_pending_requested”.
- 3. Select a request.
- 4. Click on the email address.
- 5. Write the email.
- Alternative Flow: None
Design Pattern
MVC
The project is implemented in Ruby on Rails that uses MVC architecture. It separates an application’s data model, user interface, and control logic into three distinct components (model, view and controller, respectively).
TDD
In this project, we follow the Test-driven development (TDD) software development process, which means that we would first write a test that fails before you write new functional code.
DRY
We are trying to reuse the existing functionalities in Expertiza, thus avoiding code duplication. Whenever possible, code modification based on the existing classes, controllers, or tables will be done instead of creating the new one.
Test Plan
Task 1: Test the function 'request account feature' work correctly
context 'request account feature' do it 'works correctly' # click 'REQUEST ACCOUNT' button on root path, redirect to users#request_new page
# a new user is able to add a new institution
# a new user is able to write a brief introduction
# if the email address of a new user is not valid, the flash message should display the corresponding messages
# all data can be saved to DB successfully end
Task 2: Test the page 'list_pending_requested page'
context 'on users#list_pending_requested page' do it 'allows super-admin and admin to communicate with requesters by clicking email addresses'
context 'when super-admin or admin rejects a requester' do it 'displays \'Rejected\' as status' end
context 'when super-admin or admin accepts a requester' do it 'displays \'Accept\' as status and sends an email with randomly-generated password to the new user'
context 'using name as username and password in the email' do it 'allows the new user to login Expertiza' end end end
Mockup Screen
Below are the mock-up screens that explain “new account acreation” functionality in Expertiza.
- 1.New user should click “request account” for requesting a new account, then redirect to the “request new ” page.
- 2.After redirect to “request new ” page, new users should enter their information, includes role, name, e-mail and institution. If the institution that new users want to choose is not in the list, we can choose “others” option, then a textbox will appear. We can enter our new institution in this textbox. Finally, we can click “request” button to submit our request, and wait for being approved by administrator.
- 3. If we login as administrator, we can see the screens below.
- 4. If we click “show requests”, we can see this screen. The email address is clickable.
- 5.If we click the email address, the email editor will pop out. Administrator can converse with requestor directly.
What we have accomplished
Test
Our project is a TFD project, and we got the test template from our mentor.In our test file, our test has 5 parts. In the first part, we test the request account feature. in the second part, we test the whether the email address clickable. in the third part, we test the reject function of administrator in lest_pending_requeted page. In the fourth part, we test the the accept function of administrator and test if the user will receive a confirmation email. Finally, we test if the new user can signin with new account and password.
Functions
1.Now in the new user request page, the user can add a new institution by choose 'Other' and input their own institution.
2.The new institution is able to saved into institutions table as a new record.
3.The newly created request is stored in requested_users table and has a correct institution_id.
4.The flash message on the view when validation fails is updated.
5.The administrator can access the '/users/list_pending_requested' url via “Administration > Show…>new requests” menu
The admin can access the '/users/list_pending_requested' url via “Administration > Manage>new requests” menu
6.“Email Address” column in /users/list_pending_requested page clickable.
7.After super-admin or admin approves the request, the record does not disappear on the page.
8.There is be an email send to email address offered by requester.And for super_admin and user.