Skip to content

Commit

Permalink
Merge branch 'main' into service-portal/health-overview-fix
Browse files Browse the repository at this point in the history
  • Loading branch information
kodiakhq[bot] authored May 24, 2024
2 parents 469e699 + 91ab0b7 commit 13ded3e
Show file tree
Hide file tree
Showing 7 changed files with 10 additions and 25 deletions.
3 changes: 0 additions & 3 deletions apps/service-portal/src/auth.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ import {
EndorsementsScope,
HmsScope,
NationalRegistryScope,
NotificationsScope,
UserProfileScope,
} from '@island.is/auth/scopes'

Expand Down Expand Up @@ -52,8 +51,6 @@ const SERVICE_PORTAL_SCOPES = [
ApiScope.healthRightsStatus,
ApiScope.healthDentists,
ApiScope.signatureCollection,
NotificationsScope.read,
NotificationsScope.write,
]

const userMocked = process.env.API_MOCKS === 'true'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ import {
} from '@nestjs/common'
import { ApiSecurity, ApiTags } from '@nestjs/swagger'

import { NotificationsScope } from '@island.is/auth/scopes'
import { DocumentsScope } from '@island.is/auth/scopes'
import { NotificationsService } from './notifications.service'
import {
CurrentUser,
Expand All @@ -33,8 +33,8 @@ import {
import { Documentation } from '@island.is/nest/swagger'

@UseGuards(IdsUserGuard, ScopesGuard)
@Scopes(NotificationsScope.read)
@ApiSecurity('oauth2', [NotificationsScope.read])
@Scopes(DocumentsScope.main)
@ApiSecurity('oauth2', [DocumentsScope.main])
@ApiTags('user-notification')
@Controller({
path: 'me/notifications',
Expand Down Expand Up @@ -91,8 +91,6 @@ export class MeNotificationsController {
}

@Post('/mark-all-as-seen')
@Scopes(NotificationsScope.write)
@ApiSecurity('oauth2', [NotificationsScope.write])
@Documentation({
summary: 'Updates all of current user notifications as seen',
response: { status: HttpStatus.NO_CONTENT },
Expand All @@ -102,8 +100,6 @@ export class MeNotificationsController {
}

@Post('/mark-all-as-read')
@Scopes(NotificationsScope.write)
@ApiSecurity('oauth2', [NotificationsScope.write])
@Documentation({
summary: 'Updates all of current user notifications as read',
response: { status: HttpStatus.NO_CONTENT },
Expand All @@ -117,8 +113,6 @@ export class MeNotificationsController {
response: { status: HttpStatus.OK, type: RenderedNotificationDto },
})
@Patch(':id')
@Scopes(NotificationsScope.write)
@ApiSecurity('oauth2', [NotificationsScope.write])
update(
@CurrentUser() user: User,
@Param('id') id: number,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ import {

import { AppModule } from '../../../app.module'
import { SequelizeConfigService } from '../../../sequelizeConfig.service'
import { NotificationsScope } from '@island.is/auth/scopes'
import { DocumentsScope } from '@island.is/auth/scopes'

beforeAll(async () => {
process.env.INIT_SCHEMA = 'true' // Disabling Firebase init
Expand Down Expand Up @@ -92,7 +92,7 @@ describe('MeNotificationsController - GET With Auth And Scope', () => {
AppModule,
SequelizeConfigService,
user: createCurrentUser({
scope: [NotificationsScope.read],
scope: [DocumentsScope.main],
}),
})
const server = request(app.getHttpServer())
Expand Down Expand Up @@ -122,7 +122,7 @@ describe('MeNotificationsController - PATCH With Auth And Scope', () => {
AppModule,
SequelizeConfigService,
user: createCurrentUser({
scope: [NotificationsScope.read, NotificationsScope.write],
scope: [DocumentsScope.main],
}),
})
const server = request(app.getHttpServer())
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import { CreateHnippNotificationDto } from '../dto/createHnippNotification.dto'
import { CacheModule } from '@nestjs/cache-manager'
import { getModelToken } from '@nestjs/sequelize'
import { Notification } from '../notification.model'
import { NotificationsScope } from '@island.is/auth/scopes'
import { DocumentsScope } from '@island.is/auth/scopes'
import type { User } from '@island.is/auth-nest-tools'

import {
Expand All @@ -20,7 +20,7 @@ import {

const user: User = {
nationalId: '1234567890',
scope: [NotificationsScope.read, NotificationsScope.write],
scope: [DocumentsScope.main],
authorization: '',
client: '',
}
Expand Down
5 changes: 2 additions & 3 deletions apps/services/user-notification/src/openApi.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { DocumentBuilder } from '@nestjs/swagger'
import { NotificationsScope } from '@island.is/auth/scopes'
import { DocumentsScope } from '@island.is/auth/scopes'
import { environment } from './environments/environment'

export const openApi = new DocumentBuilder()
Expand All @@ -16,8 +16,7 @@ export const openApi = new DocumentBuilder()
scopes: {
['openid']: '',
['profile']: '',
[NotificationsScope.read]: '',
[NotificationsScope.write]: '',
[DocumentsScope.main]: '',
},
authorizationUrl: `${environment.auth.issuer}/connect/authorize`,
tokenUrl: `${environment.auth.issuer}/connect/token`,
Expand Down
1 change: 0 additions & 1 deletion libs/auth/scopes/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,4 @@ export * from './lib/aosh.scope'
export * from './lib/district-commissioners.scope'
export * from './lib/hms.scope'
export * from './lib/recycling-fund.scope'
export * from './lib/notifications.scope'
export * from './lib/universityGateway.scope'
4 changes: 0 additions & 4 deletions libs/auth/scopes/src/lib/notifications.scope.ts

This file was deleted.

0 comments on commit 13ded3e

Please sign in to comment.