mirror of
https://github.com/discourse/discourse.git
synced 2024-11-30 12:43:54 -06:00
bf91532260
- Remove ArrayController - Remove {{view}} from templates - Replace many cases of needs: [‘controller’] with inject - Enable Ember Legacy Views
33 lines
843 B
JavaScript
33 lines
843 B
JavaScript
import ApiKey from 'admin/models/api-key';
|
|
|
|
export default Ember.Controller.extend({
|
|
|
|
actions: {
|
|
generateMasterKey() {
|
|
ApiKey.generateMasterKey().then(key => this.get('model').pushObject(key));
|
|
},
|
|
|
|
regenerateKey(key) {
|
|
bootbox.confirm(I18n.t("admin.api.confirm_regen"), I18n.t("no_value"), I18n.t("yes_value"), result => {
|
|
if (result) {
|
|
key.regenerate();
|
|
}
|
|
});
|
|
},
|
|
|
|
revokeKey(key) {
|
|
bootbox.confirm(I18n.t("admin.api.confirm_revoke"), I18n.t("no_value"), I18n.t("yes_value"), result => {
|
|
if (result) {
|
|
key.revoke().then(() => this.get('model').removeObject(key));
|
|
}
|
|
});
|
|
}
|
|
},
|
|
|
|
// Has a master key already been generated?
|
|
hasMasterKey: function() {
|
|
return !!this.get('model').findBy('user', null);
|
|
}.property('model.[]')
|
|
|
|
});
|