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

#167190462 Implement role based access control functionality #31

Merged
merged 7 commits into from
Aug 9, 2019

Conversation

encodedBicoding
Copy link
Contributor

What does this PR do?

  • Implements role base functionality throughout the platform
  • role is broken into ['god', 'admin', 'moderator', 'user']

Description of Task to be completed?

Duty of each role, according to the project owner

user

  • create articles
  • like articles
  • comment on articles
  • follow and unfollow other users

moderator

  • do everything a user can do
  • prevent other users from creating articles and commenting on articles
  • delete articles and comments

admin

  • do everything a moderator can do
  • make a user a moderator
  • strip a user of moderator rights (by making them a basic user)

god

  • do everything an admin can do
  • make a user an admin
  • strip a user of admin rights (by making them a moderator or a basic user)
  • delete a user's account

How should this be manually tested?

  • fetch this branch
  • install dependencies and start server npm install and npm run dev
    -use the /admin endpoint or use Swagger

Any background context you want to provide?

All implementation was done as a result of direct project owner specification.

What are the relevant pivotal tracker stories?

#167190462

Screenshots (if appropriate)

Screenshot 2019-08-07 at 11 11 56 AM

Questions:

N/A

@encodedBicoding encodedBicoding force-pushed the ft/167190462-role-base-functionality branch 2 times, most recently from 7be2e80 to 0b818f5 Compare August 7, 2019 11:45
server/tests/admin.test.js Outdated Show resolved Hide resolved
Copy link
Contributor

@chuxmykel chuxmykel left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Hadeneekeh Hadeneekeh left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

Copy link
Contributor

@Lundii Lundii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice work on your implementation. I just want to ask, can an individual have more than one role?

@encodedBicoding encodedBicoding force-pushed the ft/167190462-role-base-functionality branch from edd5a36 to bfc9244 Compare August 8, 2019 13:02
Copy link
Contributor

@cvjude cvjude left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@encodedBicoding encodedBicoding force-pushed the ft/167190462-role-base-functionality branch from bfc9244 to e4b1a9d Compare August 8, 2019 14:22
server/routes/article.js Outdated Show resolved Hide resolved
server/middlewares/schema.js Outdated Show resolved Hide resolved
server/routes/article.js Outdated Show resolved Hide resolved
server/routes/article.js Outdated Show resolved Hide resolved
server/routes/article.js Outdated Show resolved Hide resolved
server/routes/article.js Outdated Show resolved Hide resolved
server/routes/article.js Outdated Show resolved Hide resolved
server/routes/article.js Outdated Show resolved Hide resolved
errors.forEach((err) => {
if (err.type === 'string.regex.base') {
err.message = 'password must contain at least 1 uppercase, 1 lowercase, 1 number and 1 special character';
}
});
/* istanbul ignore next */
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

👍🏽

@cvjude cvjude added Please review me Needs review and removed Ready to be merged labels Aug 9, 2019
package.json Outdated
@@ -5,7 +5,7 @@
"main": "index.js",
"scripts": {
"start": "node build/index.js",
"dev": "export DEBUG=dev && nodemon --exec babel-node server/index.js",
"dev": "export DEBUG=dev && NODE_ENV=production && nodemon --exec babel-node server/index.js",
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think the former dev script is the once the team uses. The NODE_ENV=production should not to be there.

@Hadeneekeh Hadeneekeh added Work In Progress and removed Please review me Needs review labels Aug 9, 2019
encodedBicoding and others added 6 commits August 9, 2019 17:44
user can make comments to articles

[(Finishes) #167190444]
Give appropratie text to the verification email subject
Add the appropraite styling to the recieved emails
Fix the swagger endpoint for verify email link

[Fixes #167721942]
users can search by keyword
uset can search by keyword and/or categories,tags,authornames

[Delivers #167190452]
Create role base access control all over the platform

[(Delivers) #167190462]
Create role base access control all over the platform

[(Delivers) #167190462]
@encodedBicoding encodedBicoding force-pushed the ft/167190462-role-base-functionality branch from 00d98c1 to 9512ee0 Compare August 9, 2019 18:27
@topseySuave topseySuave merged commit 784a277 into develop Aug 9, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants