Skip to content
This repository has been archived by the owner on May 27, 2021. It is now read-only.

User Role #42

Open
pbteja1998 opened this issue Sep 10, 2019 · 8 comments
Open

User Role #42

pbteja1998 opened this issue Sep 10, 2019 · 8 comments
Assignees

Comments

@pbteja1998
Copy link
Member

Is your feature request related to a problem? Please describe.
A user should be able to have different roles(Admin, Candidate, ContestManager, ...etc). Right now there is no way to assign a role to the user.

Describe the solution you'd like

  • Create a separate model as Role.
  • Role will only have one field value which is of type enum(There will also be id. But created_at and updated_at fields are not necessary). This enum should have two entries for now - Candidate and Admin.
  • A user should be able to have many roles.
  • Make sure that user will have a Candidate role when the user registers through api/register route.
  • Add a separate api to add a role to the user (POST /api/users/:id/roles).
  • Add a separate api to remove a role from the user. (DELETE /api/users/:id/roles/:role_id)
@debamitra
Copy link
Collaborator

@pbteja1998 is this open to work on?

@pbteja1998
Copy link
Member Author

Yes.

@pbteja1998
Copy link
Member Author

@debamitra Shall I assign it to you?

@debamitra
Copy link
Collaborator

@pbteja1998 yes.

@pbteja1998
Copy link
Member Author

Open a WIP draft PR while developing.

@nitinrgoyal
Copy link
Collaborator

nitinrgoyal commented Sep 14, 2019

As per my understanding, OpenRank will be used by companies in-house. In that case, there should be 3 roles.

  • Admin should be some person who is setting up the system i.e. putting in their company logo, is able to see stats at company level and do such other things (in case of HackerEarth admin was able to see used credits, credit addition history but those are not relevant here. Still we may have some information to share or to change server settings.)
  • Test Manager should be a person who is creating tests & questions. Plus coordinating everything i.e. moving people to interview and things like that.
  • Candidate is a person who takes test. And may be see result, if possible.
  • User may signup using "/recruit/signup" as an Admin or "/signup" as a candidate. Every admin is also given candidate role, by default.
  • Test Manager can only be made by Admin. The test manager is also given candidate role.
  • Candidates will login using "/login" page while recruiter (Admin / Test Manager) will login from "/recruit/login" page.
  • Admin may Create User with Test Manager role - post "/api/users"

@debamitra
Copy link
Collaborator

@pbteja1998 @nitinrgoyal
Have raised a Draft PR for this issue, please provide some feedback on what needs to change.

Are we also writing some tests?

Make sure that user will have a Candidate role when the user registers through api/register route. - this one is still pending

@krushiraj
Copy link
Contributor

It's good to have tests written for this project. I guess we should mandate to write tests for anything that is added so that it won't break anything existing in the future.
I suggest to go with Mocha or Jest. Any thoughts @pbteja1998 @nitinrgoyal

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants