chore: make sub claim mapping readonly after creation (#3306)
This commit is contained in:
1 parent
f80d7ebeb3
commit
fa51973e6d
7 files changed
+201
-12
No files matched your search
@@ -48,6 +48,18 @@ export default class AuthMethodSerializer extends ApplicationSerializer {
|
||||
} else {
|
||||
delete serialized.attributes.state;
|
||||
}
|
||||
|
||||
// Don't send account_claim_maps on update if there's a saved 'sub' mapping
|
||||
// The API doesn't allow updating when 'sub' claim mappings exist
|
||||
if (!snapshot.record.isNew && snapshot.record.account_claim_maps) {
|
||||
const hasSubClaimMap = snapshot.record.account_claim_maps.some(
|
||||
(item) => item?.value === 'sub',
|
||||
);
|
||||
|
||||
if (hasSubClaimMap) {
|
||||
delete serialized.attributes.account_claim_maps;
|
||||
}
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user