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

fix(config-api): fix attribute validation issue while update #8292

Merged
merged 8 commits into from
Apr 12, 2024
18 changes: 9 additions & 9 deletions jans-config-api/docs/jans-config-api-swagger.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8219,19 +8219,19 @@ components:
type: string
selected:
type: boolean
whitePagesCanView:
type: boolean
userCanEdit:
adminCanEdit:
type: boolean
userCanView:
type: boolean
adminCanEdit:
userCanEdit:
type: boolean
adminCanView:
type: boolean
userCanAccess:
type: boolean
adminCanAccess:
type: boolean
userCanAccess:
whitePagesCanView:
type: boolean
baseDn:
type: string
Expand Down Expand Up @@ -9053,8 +9053,6 @@ components:
type: boolean
lockMessageConfig:
$ref: '#/components/schemas/LockMessageConfig'
fapi:
type: boolean
allResponseTypesSupported:
uniqueItems: true
type: array
Expand All @@ -9064,6 +9062,8 @@ components:
- code
- token
- id_token
fapi:
type: boolean
AuthenticationFilter:
required:
- baseDn
Expand Down Expand Up @@ -10083,14 +10083,14 @@ components:
type: boolean
internal:
type: boolean
locationPath:
type: string
locationType:
type: string
enum:
- ldap
- db
- file
locationPath:
type: string
baseDn:
type: string
ScriptError:
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,16 @@ public Response updateAttribute(@Valid JansAttribute attribute) {
throwBadRequestException(NAME_CONFLICT, String.format(NAME_CONFLICT_MSG, attribute.getName()));
}
}

// check if attribute exists in schema
boolean attributeValidation = attributeService.validateAttributeDefinition(attribute.getName());
log.info(" ** Validate attribute - attribute.getName():{}, attributeValidation:{}", attribute.getName(),
attributeValidation);
if (!attributeValidation) {
throw new WebApplicationException(getNotAcceptableException(
"The attribute type '" + attribute.getName() + "' not defined in DB schema"));
}
else {
// check if attribute exists in schema
boolean attributeValidation = attributeService.validateAttributeDefinition(attribute.getName());
log.info(" ** Validate attribute - attribute.getName():{}, attributeValidation:{}", attribute.getName(),
attributeValidation);
if (!attributeValidation) {
throw new WebApplicationException(getNotAcceptableException(
"The attribute type '" + attribute.getName() + "' not defined in DB schema"));
}
}

JansAttribute existingAttribute = attributeService.getAttributeByInum(inum);
checkResourceNotNull(existingAttribute, JANS_ATTRIBUTE);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,7 @@ Scenario: Get an attribute by inum
And print response


@ignore
@CreateUpdate
Scenario: Create new attribute
Given url mainUrl
Expand Down