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

feat(auth-admin): Add automaticDelegationGrant to ids admin #16864

Merged
merged 3 commits into from
Nov 21, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 6 additions & 0 deletions apps/services/auth/admin-api/project.json
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,12 @@
},
"outputs": ["{workspaceRoot}/coverage/apps/services/auth/admin-api"]
},
"dev": {
"executor": "nx:run-commands",
"options": {
"command": "yarn start --project services-auth-admin-api"
}
},
GunnlaugurG marked this conversation as resolved.
Show resolved Hide resolved
"codegen/backend-schema": {
"executor": "nx:run-commands",
"options": {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,9 @@ export class AdminPatchScopeInput {
@Field(() => Boolean, { nullable: true })
isAccessControlled?: boolean

@Field(() => Boolean, { nullable: true })
automaticDelegationGrant?: boolean

@Field(() => Boolean, {
nullable: true,
deprecationReason:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,13 @@ export class AdminPatchScopeDto {
})
isAccessControlled?: boolean

@IsBoolean()
@IsOptional()
@ApiPropertyOptional({
example: false,
})
automaticDelegationGrant?: boolean

@IsBoolean()
@IsOptional()
@ApiPropertyOptional({
Expand Down
9 changes: 9 additions & 0 deletions libs/portals/admin/ids-admin/src/lib/messages.ts
Original file line number Diff line number Diff line change
Expand Up @@ -794,6 +794,15 @@ export const m = defineMessages({
defaultMessage:
'Should the authenticated individual get this scope (uncheck if only delegated users should be allowed).',
},
automaticDelegationGrant: {
id: 'ap.ids-admin:automatic-delegation-grant',
defaultMessage: 'Automatic delegation grant',
},
automaticDelegationGrantDescription: {
id: 'ap.ids-admin:automatic-delegation-grant-description',
defaultMessage:
'Should users automatically get this permission when they authenticate with this application',
},
grantToProcuringHolders: {
id: 'ap.ids-admin:grant-to-procuring-holders',
defaultMessage: 'Companies',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ const accessControlSchema = z
.object({
isAccessControlled: booleanCheckbox,
grantToAuthenticatedUser: booleanCheckbox,
automaticDelegationGrant: booleanCheckbox,
})
.merge(defaultEnvironmentSchema)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ fragment AuthAdminScopeEnvironmentFragment on AuthAdminScopeEnvironment {
grantToPersonalRepresentatives

supportedDelegationTypes
automaticDelegationGrant
GunnlaugurG marked this conversation as resolved.
Show resolved Hide resolved
}

query AuthAdminScope($input: ScopeInput!) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,20 @@ export const PermissionAccessControl = () => {
const { formatMessage } = useLocale()
const { selectedPermission, permission } = usePermission()
const { isSuperAdmin } = useSuperAdmin()
const { isAccessControlled, grantToAuthenticatedUser } = selectedPermission
const {
isAccessControlled,
grantToAuthenticatedUser,
automaticDelegationGrant,
} = selectedPermission

const [inputValues, setInputValues] = useEnvironmentState<{
isAccessControlled: boolean
grantToAuthenticatedUser: boolean
automaticDelegationGrant: boolean
}>({
isAccessControlled,
grantToAuthenticatedUser,
automaticDelegationGrant,
})

return (
Expand All @@ -39,6 +45,7 @@ export const PermissionAccessControl = () => {
inSync={checkEnvironmentsSync(permission.environments, [
'isAccessControlled',
'grantToAuthenticatedUser',
'automaticDelegationGrant',
])}
>
<Stack space={3}>
Expand Down Expand Up @@ -70,6 +77,19 @@ export const PermissionAccessControl = () => {
}}
{...commonProps}
/>
<Checkbox
label={formatMessage(m.automaticDelegationGrant)}
subLabel={formatMessage(m.automaticDelegationGrantDescription)}
name="automaticDelegationGrant"
checked={inputValues.automaticDelegationGrant}
onChange={(e) => {
setInputValues({
...inputValues,
automaticDelegationGrant: e.target.checked,
})
}}
{...commonProps}
></Checkbox>
GunnlaugurG marked this conversation as resolved.
Show resolved Hide resolved
</Stack>
</FormCard>
)
Expand Down
Loading