Skip to content
This repository has been archived by the owner on Apr 19, 2023. It is now read-only.

Commit

Permalink
♻️ Update scopes in controllers
Browse files Browse the repository at this point in the history
  • Loading branch information
AnandChowdhary committed Nov 2, 2020
1 parent f39edda commit b490af1
Show file tree
Hide file tree
Showing 11 changed files with 19 additions and 19 deletions.
4 changes: 2 additions & 2 deletions src/modules/access-tokens/access-tokens.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class AccessTokenController {
constructor(private accessTokensService: AccessTokensService) {}

@Post()
@Scopes('user-{userId}:write-access-token')
@Scopes('user-{userId}:write-access-token-*')
async create(
@Param('userId', ParseIntPipe) userId: number,
@Body() data: CreateAccessTokenDto,
Expand All @@ -38,7 +38,7 @@ export class AccessTokenController {
}

@Get()
@Scopes('user-{userId}:read-access-token')
@Scopes('user-{userId}:read-access-token-*')
async getAll(
@Param('userId', ParseIntPipe) userId: number,
@Query('skip', OptionalIntPipe) skip?: number,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/api-keys/api-keys.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ export class ApiKeyController {
constructor(private apiKeysService: ApiKeysService) {}

@Post()
@Scopes('group-{groupId}:write-api-key')
@Scopes('group-{groupId}:write-api-key-*')
async create(
@Param('groupId', ParseIntPipe) groupId: number,
@Body() data: CreateApiKeyDto,
Expand All @@ -38,7 +38,7 @@ export class ApiKeyController {
}

@Get()
@Scopes('group-{groupId}:read-api-key')
@Scopes('group-{groupId}:read-api-key-*')
async getAll(
@Param('groupId', ParseIntPipe) groupId: number,
@Query('skip', OptionalIntPipe) skip?: number,
Expand Down
6 changes: 3 additions & 3 deletions src/modules/approved-subnets/approved-subnets.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class ApprovedSubnetController {
constructor(private approvedSubnetsService: ApprovedSubnetsService) {}

@Get()
@Scopes('user-{userId}:read-approved-location')
@Scopes('user-{userId}:read-approved-subnet-*')
async getAll(
@Param('userId', ParseIntPipe) userId: number,
@Query('skip', OptionalIntPipe) skip?: number,
Expand All @@ -39,7 +39,7 @@ export class ApprovedSubnetController {
}

@Get(':id')
@Scopes('user-{userId}:read-approved-location-{id}')
@Scopes('user-{userId}:read-approved-subnet-{id}')
async get(
@Param('userId', ParseIntPipe) userId: number,
@Param('id', ParseIntPipe) id: number,
Expand All @@ -48,7 +48,7 @@ export class ApprovedSubnetController {
}

@Delete(':id')
@Scopes('user-{userId}:delete-approved-location-{id}')
@Scopes('user-{userId}:delete-approved-subnet-{id}')
async remove(
@Param('userId', ParseIntPipe) userId: number,
@Param('id', ParseIntPipe) id: number,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/emails/emails.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class EmailController {
constructor(private emailsService: EmailsService) {}

@Post()
@Scopes('user-{userId}:write-email')
@Scopes('user-{userId}:write-email-*')
async create(
@Param('userId', ParseIntPipe) userId: number,
@Body() data: CreateEmailDto,
Expand All @@ -32,7 +32,7 @@ export class EmailController {
}

@Get()
@Scopes('user-{userId}:read-email')
@Scopes('user-{userId}:read-email-*')
async getAll(
@Param('userId', ParseIntPipe) userId: number,
@Query('skip', OptionalIntPipe) skip?: number,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/groups/groups.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export class GroupController {
constructor(private groupsService: GroupsService) {}

@Get()
@Scopes('group:read')
@Scopes('group-*:read-info')
async getAll(
@Query('skip', OptionalIntPipe) skip?: number,
@Query('take', OptionalIntPipe) take?: number,
Expand Down
6 changes: 3 additions & 3 deletions src/modules/memberships/memberships-group.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export class GroupMembershipController {
constructor(private membershipsService: MembershipsService) {}

@Post()
@Scopes('group-{groupId}:write-membership')
@Scopes('group-{groupId}:write-membership-*')
async create(
@Ip() ip: string,
@Param('groupId', ParseIntPipe) groupId: number,
Expand All @@ -38,7 +38,7 @@ export class GroupMembershipController {
}

@Get()
@Scopes('group-{groupId}:read-membership')
@Scopes('group-{groupId}:read-membership-*')
async getAll(
@Param('groupId', ParseIntPipe) groupId: number,
@Query('skip', OptionalIntPipe) skip?: number,
Expand Down Expand Up @@ -66,7 +66,7 @@ export class GroupMembershipController {
}

@Patch(':id')
@Scopes('group-{groupId}:read-membership-{id}')
@Scopes('group-{groupId}:write-membership-{id}')
async update(
@Body() data: UpdateMembershipDto,
@Param('groupId', ParseIntPipe) groupId: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ export class MultiFactorAuthenticationController {
}

@Delete()
@Scopes('user-{userId}:delete-mfa')
@Scopes('user-{userId}:delete-mfa-*')
async disable2FA(
@Param('userId', ParseIntPipe) userId: number,
): Promise<Expose<users>> {
Expand Down
2 changes: 1 addition & 1 deletion src/modules/sessions/sessions.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ export class SessionController {
constructor(private sessionsService: SessionsService) {}

@Get()
@Scopes('user-{userId}:read-session')
@Scopes('user-{userId}:read-session-*')
async getAll(
@Param('userId', ParseIntPipe) userId: number,
@Query('skip', OptionalIntPipe) skip?: number,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/stripe/stripe-invoices.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ export class StripeBillingController {
constructor(private stripeService: StripeService) {}

@Get()
@Scopes('group-{groupId}:read-invoice')
@Scopes('group-{groupId}:read-invoice-*')
async getAll(
@Param('groupId', ParseIntPipe) groupId: number,
@Query('take', OptionalIntPipe) take?: number,
Expand Down
4 changes: 2 additions & 2 deletions src/modules/stripe/stripe-sources.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,15 @@ export class StripeBillingController {
constructor(private stripeService: StripeService) {}

@Post()
@Scopes('group-{groupId}:write-source')
@Scopes('group-{groupId}:write-source-*')
async create(
@Param('groupId', ParseIntPipe) groupId: number,
): Promise<Stripe.Checkout.Session> {
return this.stripeService.createSession(groupId, 'setup');
}

@Get()
@Scopes('group-{groupId}:read-source')
@Scopes('group-{groupId}:read-source-*')
async getAll(
@Param('groupId', ParseIntPipe) groupId: number,
@Query('take', OptionalIntPipe) take?: number,
Expand Down
2 changes: 1 addition & 1 deletion src/modules/users/users.controller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class UserController {
constructor(private usersService: UsersService) {}

@Get()
@Scopes('user:read')
@Scopes('user-*:read-info')
async getAll(
@Query('skip', OptionalIntPipe) skip?: number,
@Query('take', OptionalIntPipe) take?: number,
Expand Down

0 comments on commit b490af1

Please sign in to comment.