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

#166790111: Role based access control functionality #44

Merged

Conversation

kagabof
Copy link
Contributor

@kagabof kagabof commented Jul 25, 2019

What does this PR do?

  • Role-based access control functionality

Description of Task to be completed?

  • Added model permission.
  • Added controller for the admin to create a role.
  • Added middleware to check if a user is an admin.
  • Added test for the role.
  • Added role in the token.
  • Changed role data type in the user model.

How should this be manually tested?

  • By using postman
  • By using: npm run test

Any background context you want to provide?

  • NONE

What are the relevant pivotal tracker stories?

#166790111

Screenshots

Screen Shot 2019-07-21 at 16 38 58

Questions:

src/models/Permissions.js Outdated Show resolved Hide resolved
type: Sequelize.DATE },
updatedAt: { allowNull: false,
type: Sequelize.DATE } }),
down: (queryInterface, Sequelize) => queryInterface.dropTable('Permissions') };
Copy link

Choose a reason for hiding this comment

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

'Sequelize' is defined but never used no-unused-vars

src/controllers/userController.js Outdated Show resolved Hide resolved
@kagabof kagabof force-pushed the ft-Role-based-access-control-functionality-166790111 branch 4 times, most recently from 665e8de to 1b6fba0 Compare July 28, 2019 23:42
src/test/roleTest.js Outdated Show resolved Hide resolved
.then(() => {
queryInterface.sequelize.query('ALTER TABLE "Permissions" ADD CONSTRAINT "permissions-pks" PRIMARY KEY ("role", "actions")');
}),
down: (queryInterface, Sequelize) => queryInterface.dropTable('Permissions') };
Copy link

Choose a reason for hiding this comment

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

'Sequelize' is defined but never used no-unused-vars

src/migrations/20190725090430-create-permissions.js Outdated Show resolved Hide resolved
@kagabof kagabof force-pushed the ft-Role-based-access-control-functionality-166790111 branch from 1b6fba0 to 4ff05fb Compare July 28, 2019 23:50
Copy link
Contributor

@FlevianK FlevianK left a comment

Choose a reason for hiding this comment

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

Remove extra black lines

@kagabof kagabof force-pushed the ft-Role-based-access-control-functionality-166790111 branch from 4ff05fb to 9f6b4b1 Compare July 29, 2019 07:58
- Added contoller for the admin to create a role.
- Added middleware to check if user is admin.
- Added test for role.
- Added role in the token.
- Changed role data type in the user model.
@kagabof kagabof force-pushed the ft-Role-based-access-control-functionality-166790111 branch from 9f6b4b1 to e6a9e4f Compare July 29, 2019 08:19
@FlevianK FlevianK merged commit 078ae9f into develop Jul 29, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants