mirror of
https://github.com/discourse/discourse.git
synced 2025-02-25 18:55:32 -06:00
FEATURE: Allow admins to delete user SSO records in the UI (#10669)
Also displays the user's last payload in the admin UI to help with debugging SSO issues.
This commit is contained in:
@@ -132,6 +132,11 @@ export default Controller.extend(CanCheckEmails, {
|
||||
.catch(() => bootbox.alert(I18n.t("generic_error")));
|
||||
},
|
||||
|
||||
@discourseComputed("model.single_sign_on_record.last_payload")
|
||||
ssoPayload(lastPayload) {
|
||||
return lastPayload.split("&");
|
||||
},
|
||||
|
||||
actions: {
|
||||
impersonate() {
|
||||
return this.model.impersonate();
|
||||
@@ -321,5 +326,16 @@ export default Controller.extend(CanCheckEmails, {
|
||||
resetPrimaryGroup() {
|
||||
this.set("model.primary_group_id", this.originalPrimaryGroupId);
|
||||
},
|
||||
|
||||
deleteSSORecord() {
|
||||
return bootbox.confirm(
|
||||
I18n.t("admin.user.sso.confirm_delete"),
|
||||
I18n.t("no_value"),
|
||||
I18n.t("yes_value"),
|
||||
() => {
|
||||
return this.model.deleteSSORecord();
|
||||
}
|
||||
);
|
||||
},
|
||||
},
|
||||
});
|
||||
|
||||
@@ -567,6 +567,16 @@ const AdminUser = User.extend({
|
||||
_formatError(event) {
|
||||
return `http: ${event.status} - ${event.body}`;
|
||||
},
|
||||
|
||||
deleteSSORecord() {
|
||||
return ajax(`/admin/users/${this.id}/sso_record.json`, {
|
||||
type: "DELETE",
|
||||
})
|
||||
.then(() => {
|
||||
this.set("single_sign_on_record", null);
|
||||
})
|
||||
.catch(popupAjaxError);
|
||||
},
|
||||
});
|
||||
|
||||
AdminUser.reopenClass({
|
||||
|
||||
@@ -652,6 +652,16 @@
|
||||
<div class="display-row">
|
||||
<div class="field">{{i18n "admin.user.sso.external_id"}}</div>
|
||||
<div class="value">{{sso.external_id}}</div>
|
||||
{{#if model.can_delete_sso_record}}
|
||||
<div class="controls">
|
||||
{{d-button
|
||||
class="btn-danger"
|
||||
action=(action "deleteSSORecord")
|
||||
icon="far-trash-alt"
|
||||
label="admin.user.sso.delete_sso_record"
|
||||
}}
|
||||
</div>
|
||||
{{/if}}
|
||||
</div>
|
||||
<div class="display-row">
|
||||
<div class="field">{{i18n "admin.user.sso.external_username"}}</div>
|
||||
@@ -671,6 +681,16 @@
|
||||
<div class="field">{{i18n "admin.user.sso.external_avatar_url"}}</div>
|
||||
<div class="value">{{sso.external_avatar_url}}</div>
|
||||
</div>
|
||||
{{#if sso.last_payload}}
|
||||
<div class="display-row">
|
||||
<div class="field">{{i18n "admin.user.sso.last_payload"}}</div>
|
||||
<div class="value">
|
||||
{{#each ssoPayload as |line|}}
|
||||
{{line}}<br>
|
||||
{{/each}}
|
||||
</div>
|
||||
</div>
|
||||
{{/if}}
|
||||
{{/with}}
|
||||
</section>
|
||||
{{/if}}
|
||||
|
||||
Reference in New Issue
Block a user