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

WIP : !!! RBAC . #54 #53

Closed
wants to merge 3 commits into from
Closed

WIP : !!! RBAC . #54 #53

wants to merge 3 commits into from

Conversation

tomahawk-pilot
Copy link
Member

Role-based access control
CQRS implementation

@tomahawk-pilot tomahawk-pilot requested a review from a team as a code owner January 30, 2021 10:34
@tomahawk-pilot
Copy link
Member Author

Don't merge this request since this has some breaking changes

@lgtm-com
Copy link

lgtm-com bot commented Jan 30, 2021

This pull request introduces 4 alerts when merging 37e18fc into 6b1b7a0 - view on LGTM.com

new alerts:

  • 4 for Unused variable, import, function or class

@riginoommen riginoommen changed the title WIP !!! RBAC . WIP: !!! RBAC . Jan 30, 2021
@riginoommen riginoommen changed the title WIP: !!! RBAC . WIP : !!! RBAC . Jan 30, 2021
@riginoommen
Copy link
Member

Create the issue number and tad it with the template.

@tomahawk-pilot tomahawk-pilot changed the title WIP : !!! RBAC . WIP : !!! RBAC . #54 Jan 30, 2021
@tomahawk-pilot
Copy link
Member Author

#54

@lgtm-com
Copy link

lgtm-com bot commented Jan 30, 2021

This pull request introduces 7 alerts when merging 25f35c0 into 9a5008d - view on LGTM.com

new alerts:

  • 7 for Unused variable, import, function or class

@tomahawk-pilot tomahawk-pilot added this to In progress in Hello Munnar via automation Jan 30, 2021
@tomahawk-pilot tomahawk-pilot linked an issue Jan 30, 2021 that may be closed by this pull request
@tomahawk-pilot tomahawk-pilot added this to the Security milestone Jan 30, 2021
@Entity('users')
@Unique(['email'])
export default class Users {
export class Users {
@PrimaryGeneratedColumn()

Choose a reason for hiding this comment

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

Class name should be User

cascade: ['update'],
})
@JoinColumn({ name: 'id' })
roleUsers: RoleUsers[];

Choose a reason for hiding this comment

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

This roleUsers property is a single item. So change it ti roleUser

import { Roles } from './index';

@Entity('role_users')
export class RoleUsers {

Choose a reason for hiding this comment

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

Class name should be RoleUser


@ManyToOne((type) => Roles, (roles) => roles.roleUsers)
@JoinColumn({ name: 'roleId' })
roles: Roles;

Choose a reason for hiding this comment

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

Change property roles to role

import { Roles } from './index';

@Entity('role_actions')
export class RoleActions {

Choose a reason for hiding this comment

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

RoleAction instead of RoleActions

import { IsString, IsOptional } from 'class-validator';

@Entity('roles')
export class Roles {

Choose a reason for hiding this comment

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

Role instead of Roles

@riginoommen riginoommen removed their assignment Jan 30, 2021
async execute(command: AuthCommand) {
const { user, type } = command;
const role = await this.roleService.getRoleByName(
'SuperAdmin',

Choose a reason for hiding this comment

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

Please remove SuperAdmin

generationStrategy: 'increment',
},
{
name: 'name',

Choose a reason for hiding this comment

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

name should be unique

columnNames: ['createdBy'],
referencedColumnNames: ['id'],
referencedTableName: 'users',
onDelete: 'CASCADE',

Choose a reason for hiding this comment

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

Suggested change
onDelete: 'CASCADE',
onDelete: 'CASCADE', - better avoid cascade delete, instead use soft delete

},
{
name: 'createdAt',
type: 'timestamp',
Copy link

@prathapvpc prathapvpc Jan 30, 2021

Choose a reason for hiding this comment

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

Suggested change
type: 'timestamp',
type: 'timestamp', - better use bigint instead of timestamp. Applicable to all timestamp type

@sonarcloud
Copy link

sonarcloud bot commented Jan 30, 2021

SonarCloud Quality Gate failed.

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 9 Code Smells

No Coverage information No Coverage information
6.6% 6.6% Duplication

@lgtm-com
Copy link

lgtm-com bot commented Jan 30, 2021

This pull request introduces 7 alerts when merging c89fd2f into 6349432 - view on LGTM.com

new alerts:

  • 7 for Unused variable, import, function or class

Hello Munnar automation moved this from In progress to Done Jan 30, 2021
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
block Database enhancement New feature or request
Projects
Development

Successfully merging this pull request may close these issues.

Role based access
3 participants