-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #100 from adnanhemani/varun_superadmin_delete_all
Varun superadmin delete all
- Loading branch information
Showing
12 changed files
with
187 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,106 @@ | ||
<html> | ||
<head> | ||
<%= stylesheet_link_tag 'application', media: 'all', 'data-turbolinks-track' => true %> | ||
<%= javascript_include_tag 'application', 'data-turbolinks-track' => true %> | ||
</head> | ||
<body> | ||
<h1>Teams</h1> | ||
<table class="table table-striped table-hover" style="border: 1px solid black; padding: 15px; border-spacing: 5px; border-collapse: collapse; width: 100%; "> | ||
<tr style="border: 1px solid black;"> | ||
<td>Team ID</td> | ||
<td>Passcode</td> | ||
<td>Members</td> | ||
<td>Approved?</td> | ||
<td>Submitted?</td> | ||
<td>Submission ID</td> | ||
<td>Created On</td> | ||
<td>Updated On</td> | ||
</tr> | ||
<% Team.all.each do |t| %> | ||
<tr> | ||
<td><%= t.id %></td> | ||
<td><%= t.passcode %></td> | ||
<td><% t.users.each do |u| %> | ||
<%= u.name %> | ||
<br> | ||
<% end %></td> | ||
<td><%= t.approved ? 'Approved' : 'Not Approved' %></td> | ||
<td><%= t.submitted ? 'Approved' : 'Not Approved' %></td> | ||
<td><%= t.submission_id %></td> | ||
<td><%= t.created_at %></td> | ||
<td><%= t.updated_at %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
<h1>Users</h1> | ||
<table class="table table-striped table-hover" style="border: 1px solid black; padding: 15px; border-spacing: 5px; border-collapse: collapse; width: 100%; "> | ||
<tr style="border: 1px solid black;"> | ||
<td>User ID</td> | ||
<td>Name</td> | ||
<td>Email</td> | ||
<td>Major</td> | ||
<td>SID</td> | ||
<td>Team ID</td> | ||
<td>Created On</td> | ||
<td>Updated On</td> | ||
</tr> | ||
<% User.all.each do |u| %> | ||
<tr> | ||
<td><%= u.id %></td> | ||
<td><%= u.name %></td> | ||
<td><%= u.email %></td> | ||
<td><%= u.major %></td> | ||
<td><%= u.sid %></td> | ||
<td><%= u.team_id %></td> | ||
<td><%= u.created_at %></td> | ||
<td><%= u.updated_at %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
<h1>Discussions</h1> | ||
<table class="table table-striped table-hover" style="border: 1px solid black; padding: 15px; border-spacing: 5px; border-collapse: collapse; width: 100%; "> | ||
<tr style="border: 1px solid black;"> | ||
<td>Number</td> | ||
<td>Time</td> | ||
<td>Day</td> | ||
<td>Teams</td> | ||
<td>Capacity</td> | ||
<td>Submission ID</td> | ||
</tr> | ||
<% Discussion.all.each do |d| %> | ||
<tr> | ||
<td><%= d.number %></td> | ||
<td><%= d.time %></td> | ||
<td><%= d.day %></td> | ||
<td><% d.teams.each do |t| %> | ||
<%= t.id %> | ||
<br> | ||
<% end %></td> | ||
<td><%= d.capacity %></td> | ||
<td><%= d.submission_id %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
<h1>Submissions</h1> | ||
<table class="table table-striped table-hover" style="border: 1px solid black; padding: 15px; border-spacing: 5px; border-collapse: collapse; width: 100%; "> | ||
<tr style="border: 1px solid black;"> | ||
<td>Team ID</td> | ||
<td>Discussion 1</td> | ||
<td>Discussion 2</td> | ||
<td>Discussion 3</td> | ||
<td>Created On</td> | ||
<td>Updated On</td> | ||
</tr> | ||
<% Submission.all.each do |s| %> | ||
<tr> | ||
<td><%= s.team.id %></td> | ||
<td><%= s.disc1id %></td> | ||
<td><%= s.disc2id %></td> | ||
<td><%= s.disc3id %></td> | ||
<td><%= s.created_at %></td> | ||
<td><%= s.updated_at %></td> | ||
</tr> | ||
<% end %> | ||
</table> | ||
</body> | ||
</html> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
<body> | ||
<title>Reset Semester</title> | ||
<div class="container"> | ||
<h1>Reset Semester</h1> | ||
<% if @admin.superadmin == true %> | ||
<br> | ||
<p>Warning: Resetting the semester will result in all users, teams, and discussions being deleted. This is to be used at the end of the semester, to prepare for a new semester of enrollment. This action can only be performed by the super admin, and is passcode protected. An email will be sent to you with all the data that has been deleted.</p> | ||
<br> | ||
<%= form_tag reset_database_path, class: "form-group" do %> | ||
<div class="input-group"> | ||
<span class="input-group-addon">Password</span> | ||
<%= text_field_tag :reset_password, params[:team_hash], class: "form-control" %> | ||
<span class="input-group-btn"> | ||
<input type='submit' class='btn btn-primary' value='Reset' data-confirm="Are you absolutely sure you want to do this?"/> | ||
</span> | ||
</div> | ||
<% end %> | ||
<% else %> | ||
<p>You don't have access to this page.</p> | ||
<% end %> | ||
</div> | ||
</body> | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,15 +1,15 @@ | ||
-----BEGIN PGP MESSAGE----- | ||
Version: GnuPG v1 | ||
|
||
jA0EAwMCzX1vR3oXYmBgycDpNEJ2nY+FUGDFXJqpVTflmrPlXbyZFIu7mE3R8CDC | ||
RcKxjx4MKOqCnfUUGDy22bZJNOzpKAEHtJ9AzOe9lkAtOWgxmmksUuTz5KpboDS0 | ||
GyceNC+ag8gqyEKGw51LjkcZEI5Ugx/tHz6tqJsR2iDVNe8RuiT175XY/KogmGqm | ||
B9GDYikYf6TeOVYMT340wzlb9oLxL4OFtR4XmjCqkCXq7GLUt4/XiDCtR4O4LSTy | ||
Ss2fN1LUwQtKbZRM15InSlmmIH90BNb4VUPMfS+dwIIYYW2X8VuJhSvYI2AR7A4s | ||
78plK+XI2sRtfaWzDtGTZg96GnwjbmMwMyjyKMkIzkiKp7ivzJYh0Kvz7VgSnlkf | ||
fM61EjbOHtjbnRPgTOe5e0K/kkN1tuWkVcL9pz9TomnQgctB/hNK5AAVut5HzKmk | ||
Tz6Vwuocy81cdmPV/1nhFK7JaRB0/RQru9KgCwOAB3QTuxAOUyz8v1gLEmU8OL2c | ||
0DaPHEsm0D+gYs7/B1pVb/F3QENWSIkr+qPa8nPH8QXCbeCA4jE4bT1TiTIcf7Le | ||
wvADoTtansUTZu4= | ||
=IbuS | ||
jA0EAwMCG7xieGrm/C1gycEGmzipAKljnxD97E6CAnSAUgM/DUuC0YQaYulU6/bN | ||
J4amg18l3zGOQho85119Gg4v46y3yLc0Bcq7f4RNF70j/S9iymouqvzzZNbxdOBn | ||
ewl6Oxm/qXWKkXz31GmPnQSzB2i7meVmm4zMlWB8JZiFxbRcQT2pWXAIMddkGeHT | ||
ycT2w6RdeeM980xVlZwClq0Ums5N+gSrOLk0A8MFeherejW40KOszdlr7o0kDv9h | ||
3vRinSUsWFzBDg8y9KWIhPokwcaOiyDFbD7W8jPHsRMGxb1Nt+y1DzVnMm6/zje5 | ||
nxro961wsJXoOPZQRzjYYbQUqbDFfh4OVWRZyyi289oOKXqlRv9T/x+0HdakL2W3 | ||
bPnTCJ4c1alcM5e311FAmO8pswRI1m4fV+C8UX5Q80/DX/hd3O4ynzVxkEkO6EWA | ||
ar+qpzsvLn+OimJhWHs4oGZgKoESBsPjHPEARyXxeZcSmMWbewwyt7KHk7IoMN++ | ||
fkJJTkF+XAApKN8YpYGJC7+a7ozfOiX5yGw+t6gB+SMoIDAZrIda83bAG+q+Q8IP | ||
r/3Sg0LhQJBZsbi1hzD1JOSphWkErLj69UT1j5hl2YVsk8aLkIko/Q== | ||
=pBsM | ||
-----END PGP MESSAGE----- |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,9 +5,9 @@ Feature: Super admin deletes all data | |
I want to be able to delete the entire database | ||
|
||
Background: | ||
Given the following admin exists | ||
| name | email | password | | ||
| Bob | supreme_ruler@aol.com | ilikcats | | ||
Given the following admins exist | ||
| name | email | superadmin | | ||
| Bob | supreme_ruler@aol.com | true | | ||
Given the following users exist | ||
| name | email | team | major | sid | | ||
| Jorge | legueoflegends667@hotmail.com | somepassc | Football Player | 999 | | ||
|
@@ -26,14 +26,13 @@ Feature: Super admin deletes all data | |
And I log in as an admin with email "[email protected]" | ||
|
||
Scenario: Super admin successfully deletes everything from database | ||
When PENDING: I press "Delete All Data" | ||
Then PENDING: I should see "Warning: this will delete all users, teams, discussions, and sections" | ||
And PENDING: I should see "Enter a password to confirm this action" | ||
When PENDING: I fill in "enrollme" | ||
And PENDING: I press "Enter" | ||
Then PENDING: I should see "All data deleted" | ||
And PENDING: I should not see "Jorge" | ||
And PENDING: I should not see "Pending" | ||
When PENDING: I press "Choose Discussions" | ||
Then PENDING: I should not see "54321" | ||
|
||
Then print page body | ||
When I follow "Reset Semester" | ||
Then I should see "Warning: Resetting the semester will result in all users, teams, and discussions being deleted." | ||
And I should see "Password" | ||
When I fill in "reset_password" with API['ADMIN_DELETE_DATA_PASSWORD'] | ||
And I press "Reset" | ||
Then I should see "All data reset" | ||
And I should not see "Jorge" | ||
When I press "Discussions" | ||
Then I should not see "54321" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters