-
Notifications
You must be signed in to change notification settings - Fork 57
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
resolving merge conflicts on a deleted file
- Loading branch information
Showing
160 changed files
with
2,546 additions
and
559 deletions.
There are no files selected for viewing
Validating CODEOWNERS rules …
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 2 additions & 2 deletions
4
apps/application-system/api/src/app/modules/application/utils/delegationUtils.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
98 changes: 98 additions & 0 deletions
98
apps/services/auth/admin-api/src/app/v2/delegations/delegation-admin.controller.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
import { | ||
Controller, | ||
Delete, | ||
Get, | ||
Headers, | ||
Param, | ||
UseGuards, | ||
} from '@nestjs/common' | ||
import { ApiTags } from '@nestjs/swagger' | ||
|
||
import { | ||
CurrentUser, | ||
IdsUserGuard, | ||
Scopes, | ||
ScopesGuard, | ||
User, | ||
} from '@island.is/auth-nest-tools' | ||
import { | ||
DelegationAdminCustomDto, | ||
DelegationAdminCustomService, | ||
} from '@island.is/auth-api-lib' | ||
import { Documentation } from '@island.is/nest/swagger' | ||
import { Audit, AuditService } from '@island.is/nest/audit' | ||
import { DelegationAdminScopes } from '@island.is/auth/scopes' | ||
import flatMap from 'lodash/flatMap' | ||
import { isDefined } from '@island.is/shared/utils' | ||
|
||
const namespace = '@island.is/auth/delegation-admin' | ||
|
||
@UseGuards(IdsUserGuard, ScopesGuard) | ||
@Scopes(DelegationAdminScopes.read) | ||
@ApiTags('delegation-admin') | ||
@Controller('delegation-admin') | ||
@Audit({ namespace }) | ||
export class DelegationAdminController { | ||
constructor( | ||
private readonly delegationAdminService: DelegationAdminCustomService, | ||
private readonly auditService: AuditService, | ||
) {} | ||
|
||
@Get() | ||
@Documentation({ | ||
response: { status: 200, type: DelegationAdminCustomDto }, | ||
request: { | ||
header: { | ||
'X-Query-National-Id': { | ||
required: true, | ||
description: 'fetch delegations for this national id', | ||
}, | ||
}, | ||
}, | ||
}) | ||
@Audit<DelegationAdminCustomDto>({ | ||
resources: (delegation) => | ||
flatMap([ | ||
...delegation.incoming.map((d) => d.id ?? undefined), | ||
...delegation.outgoing.map((d) => d.id ?? undefined), | ||
]).filter(isDefined), | ||
}) | ||
async getDelegationAdmin( | ||
@Headers('X-Query-National-Id') nationalId: string, | ||
): Promise<DelegationAdminCustomDto> { | ||
return await this.delegationAdminService.getAllDelegationsByNationalId( | ||
nationalId, | ||
) | ||
} | ||
|
||
@Delete(':delegationId') | ||
@Scopes(DelegationAdminScopes.admin) | ||
@Documentation({ | ||
response: { status: 204 }, | ||
request: { | ||
params: { | ||
delegationId: { | ||
required: true, | ||
description: 'The id of the delegation to delete', | ||
}, | ||
}, | ||
}, | ||
}) | ||
delete( | ||
@CurrentUser() user: User, | ||
@Param('delegationId') delegationId: string, | ||
) { | ||
return this.auditService.auditPromise( | ||
{ | ||
auth: user, | ||
namespace, | ||
action: 'delete', | ||
resources: delegationId, | ||
meta: (deleted) => ({ | ||
deleted, | ||
}), | ||
}, | ||
this.delegationAdminService.deleteDelegation(user, delegationId), | ||
) | ||
} | ||
} |
12 changes: 12 additions & 0 deletions
12
apps/services/auth/admin-api/src/app/v2/delegations/delegation-admin.module.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
import { Module } from '@nestjs/common' | ||
|
||
import { DelegationsModule as AuthDelegationsModule } from '@island.is/auth-api-lib' | ||
import { FeatureFlagModule } from '@island.is/nest/feature-flags' | ||
import { DelegationAdminController } from './delegation-admin.controller' | ||
|
||
@Module({ | ||
imports: [AuthDelegationsModule, FeatureFlagModule], | ||
controllers: [DelegationAdminController], | ||
providers: [], | ||
}) | ||
export class DelegationAdminModule {} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.