Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AdminsController currently handles CRUD for Organization model which is a mismatch of resource, this should be refactored #326

Closed
5 of 16 tasks
armahillo opened this issue May 11, 2018 · 8 comments · Fixed by #493

Comments

@armahillo
Copy link
Collaborator

armahillo commented May 11, 2018

/app/controllers/admins_controller.rb has CRUD actions for maintaining Organization records.

Instead, we should create an admin namespace, set up authorization there (the User model already has is_super_admin?) and then create an organizations_controller.rb within it that performs these actions. We can also set up Admin CRUD for Canonicaltem, Users, and BarcodeItem.

  • Create Admin namespace
  • Create Admin::OrganizationsController
  • Create Admin::CanonicalItemsController
  • Create Admin::UsersController
  • Create Admin::BarcodeItemsController
  • Remove previous administrative functions for those models from other places they may have been
  • Write new specs to cover these new controllers
  • Write new views for these new controllers
  • Fix any broken specs

User Interface for BarcodeAdmin

  • Default view for Admin::BarcodeItems#index is global only (we will likely need to add will_paginate)
  • Filter on canonical item
  • Filter on "global?"
  • Filter on barcode value
  • Filter on organization
  • Add New Barcode for adding new Global barcodes (mapping to canonical items only)
  • Create a new action / view that creates a report of commonly used barcode values across multiple organizations
@armahillo armahillo added this to the Ruby Five Good (2018) milestone May 11, 2018
@IlinDmitry
Copy link
Collaborator

Hello @armahillo! I read about Active Admin.
Maybe it's fit to this task?

@armahillo
Copy link
Collaborator Author

armahillo commented May 12, 2018

@IlinDmitry Hello!
Funny you should mention that... That was actually what we used for the very first iteration of this project, --two-- three years ago!

I think AA would add more complexity than we need; but if you want to do this and keep it simple, basic rails scaffolds would probably be fine for the Controller/Views, so long as authorization is added. :)

@IlinDmitry IlinDmitry self-assigned this May 14, 2018
@IlinDmitry
Copy link
Collaborator

@armahillo, hi.
I see that CanonicalItem is only in your branch 314-item-refactor.
Should i use it, or better wait untill you'll merge into master?

@armahillo
Copy link
Collaborator Author

armahillo commented May 14, 2018 via email

@armahillo
Copy link
Collaborator Author

@IlinDmitry OK #314 has been merged into master - if you're still interested in working on this one, it's ready to be worked on. :)

@IlinDmitry
Copy link
Collaborator

@armahillo, hi!
Now user with regular rights can create/edit/delete barcodes.
With the new functionality user with regular rights would only view them?
Only user with superadmin rights would create/edit/delete barcodes?
Or maybe user with regular rights would also create new barcodes when creating new donations?

User with superadmin rights can edit/delete only for models, that belongs to his organization or for all organizations?

@armahillo
Copy link
Collaborator Author

@IlinDmitry You're definitely going in the right direction.

Non-Admins should still be able to edit/update their own organization, and users should be able to update their own records (I saw that both Organizations and Users had been moved into the Admin namespace, which is fine, but the Admin namespace actions should be more global, and the non-Admin ones should be scoped down to only what the user needs to be able to see).

Re: Barcodes
Users can still create barcodes, but the barcodes will associate with Item. The global barcodes are associated with CanonicalItem. That's the main difference. The global ones would be in the admin namespace, non-global ones can still be in the regular namespace.

SuperAdmins should be able to do CRUD actions on the models I mention in the original post.

Does this make sense?

@armahillo
Copy link
Collaborator Author

@IlinDmitry Hello! Have you been able to work on this at all? If not, push up any latest changes and one of us can take it over, IIRC you've got exciting family stuff happening right now :) Let me know!

@armahillo armahillo self-assigned this Oct 7, 2018
@armahillo armahillo removed the Help Wanted Groomed + open to all! label Oct 7, 2018
armahillo pushed a commit that referenced this issue Oct 8, 2018
seanmarcia added a commit that referenced this issue Oct 8, 2018
WIP Fixes #326 Admins Controller, namespaced separately
LizPrescott pushed a commit to LizPrescott/diaper that referenced this issue Nov 3, 2018
LizPrescott pushed a commit to LizPrescott/diaper that referenced this issue Nov 3, 2018
@armahillo armahillo reopened this Nov 6, 2018
@armahillo armahillo removed their assignment Nov 6, 2018
@armahillo armahillo added Help Wanted Groomed + open to all! and removed In Progress labels Nov 6, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants