2015-11-21 09:27:06 +08:00
|
|
|
import Group from "discourse/models/group";
|
2023-10-11 02:38:59 +08:00
|
|
|
import DiscourseRoute from "discourse/routes/discourse";
|
2015-03-11 03:01:15 +08:00
|
|
|
|
2023-03-15 21:17:51 +08:00
|
|
|
export default class AdminUserIndexRoute extends DiscourseRoute {
|
2015-03-11 03:01:15 +08:00
|
|
|
model() {
|
|
|
|
return this.modelFor("adminUser");
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
2015-03-11 03:01:15 +08:00
|
|
|
|
|
|
|
afterModel(model) {
|
2019-05-13 23:04:41 +08:00
|
|
|
if (this.currentUser.admin) {
|
|
|
|
return Group.findAll().then((groups) => {
|
|
|
|
this._availableGroups = groups.filterBy("automatic", false);
|
2015-03-11 03:01:15 +08:00
|
|
|
return model;
|
|
|
|
});
|
|
|
|
}
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
2015-03-11 03:01:15 +08:00
|
|
|
|
|
|
|
setupController(controller, model) {
|
|
|
|
controller.setProperties({
|
2019-05-13 23:04:41 +08:00
|
|
|
originalPrimaryGroupId: model.primary_group_id,
|
2015-03-11 03:01:15 +08:00
|
|
|
availableGroups: this._availableGroups,
|
2020-02-03 21:22:14 +08:00
|
|
|
customGroupIdsBuffer: model.customGroups.mapBy("id"),
|
2021-10-20 19:51:32 +08:00
|
|
|
ssoExternalEmail: null,
|
|
|
|
ssoLastPayload: null,
|
2015-03-11 03:01:15 +08:00
|
|
|
model,
|
|
|
|
});
|
2023-03-15 21:17:51 +08:00
|
|
|
}
|
|
|
|
}
|