Browse Source
* Admi Users must sign in to access panel * Add ADR doc for design decision * Add AdminUsers dashboard to ActiveAdminpull/107/head
Daniel Baark
3 years ago
committed by
GitHub
8 changed files with 75 additions and 4 deletions
@ -0,0 +1,27 @@
|
||||
ActiveAdmin.register AdminUser do |
||||
permit_params :email, :password, :password_confirmation |
||||
|
||||
index do |
||||
selectable_column |
||||
id_column |
||||
column :email |
||||
column :current_sign_in_at |
||||
column :sign_in_count |
||||
column :created_at |
||||
actions |
||||
end |
||||
|
||||
filter :email |
||||
filter :current_sign_in_at |
||||
filter :sign_in_count |
||||
filter :created_at |
||||
|
||||
form do |f| |
||||
f.inputs do |
||||
f.input :email |
||||
f.input :password |
||||
f.input :password_confirmation |
||||
end |
||||
f.actions |
||||
end |
||||
end |
@ -0,0 +1,5 @@
|
||||
class AdminUser < ApplicationRecord |
||||
# Include default devise modules. Others available are: |
||||
# :confirmable, :lockable, :timeoutable, :trackable and :omniauthable |
||||
devise :database_authenticatable, :recoverable, :rememberable, :validatable |
||||
end |
@ -0,0 +1,18 @@
|
||||
class AddAdminUsers < ActiveRecord::Migration[6.1] |
||||
def change |
||||
create_table :admin_users do |t| |
||||
## Database authenticatable |
||||
t.string :email, null: false, default: "" |
||||
t.string :encrypted_password, null: false, default: "" |
||||
|
||||
## Recoverable |
||||
t.string :reset_password_token |
||||
t.datetime :reset_password_sent_at |
||||
|
||||
## Rememberable |
||||
t.datetime :remember_created_at |
||||
|
||||
t.timestamps null: false |
||||
end |
||||
end |
||||
end |
@ -0,0 +1,9 @@
|
||||
### ADR - 010: Admin Users vs Users |
||||
|
||||
#### Why do we have 2 User classes, AdminUser and User? |
||||
|
||||
This is modelling a real life split. `AdminUsers` are internal DLUHC users or helpdesk employees. While `Users` are external users working at data providing organisations. So local authority/housing association's "admin" users, i.e. Data Co-ordinators are a type of the User class. They have the ability to add or remove other users to or from their organisation, and to update their organisation details etc, but only through the designed UI. They do not get direct access to ActiveAdmin. |
||||
|
||||
AdminUsers on the other hand get direct access to ActiveAdmin. From there they can download entire datasets (via CSV, XML, JSON), view any log from any organisation, and add or remove users of any type including other Admin users. This means TDA will likely also require more stringent authentication for them using MFA (which users will likely not require). So the class split also helps there. |
||||
|
||||
A potential downside to this approach is that it does not currently allow for `AdminUsers` to sign into the application UI itself with their Admin credentials. However, we need to see if there's an actual use case for this and what it would be (since they aren't part of an organisation to be uploading data for, but could add or amend data or user or org details through ActiveAdmin anyway). If there is a strong use case for it this could be work around by either: providing them with two sets of credentials, or modifying the `authenticate_user` method to also check `AdminUser` credentials. |
Loading…
Reference in new issue