refactor: 💡 Refactor ldap account view and serializer (#1826)
* refactor: 💡 Refactor ldap account view and serializer Refactor LDAP account view to only show `InfoField` fields if values are not `undefined`. Also fixed bug for updating accounts. ✅ Closes: ICU-10514 * refactor: 💡 clean up code Quick cleanup of code for accounts * Update account.js change text for commit * Update index.hbs * refactor: 💡 format hbs format hbs
This commit is contained in:
1 parent
de77f8807d
commit
e089d1c3ff
4 files changed
+50
-23
No files matched your search
@@ -13,13 +13,11 @@ export default class GeneratedAccountModel extends BaseModel {
|
||||
// =attributes
|
||||
|
||||
@attr('string', {
|
||||
readOnly: true,
|
||||
description: 'The type of the resource, to help differentiate schemas',
|
||||
})
|
||||
type;
|
||||
|
||||
@attr('string', {
|
||||
readOnly: true,
|
||||
description: 'The owning auth method ID.',
|
||||
})
|
||||
auth_method_id;
|
||||
|
||||
@@ -52,6 +52,10 @@ export default class AccountSerializer extends ApplicationSerializer {
|
||||
serialized.attributes = {};
|
||||
const { login_name } = snapshot.record;
|
||||
if (login_name) serialized.attributes.login_name = login_name;
|
||||
} else {
|
||||
// LDAP does not support updating the readonly auth method ID or type attributes.
|
||||
delete serialized.auth_method_id;
|
||||
delete serialized.type;
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
@@ -69,6 +73,10 @@ export default class AccountSerializer extends ApplicationSerializer {
|
||||
const { issuer, subject } = snapshot.record;
|
||||
if (issuer) serialized.attributes.issuer = issuer;
|
||||
if (subject) serialized.attributes.subject = subject;
|
||||
} else {
|
||||
// OIDC does not support updating the readonly auth method ID or type attributes.
|
||||
delete serialized.auth_method_id;
|
||||
delete serialized.type;
|
||||
}
|
||||
return serialized;
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user