security.js 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. App.MainAdminSecurityController = Em.Controller.extend({
  20. name: 'mainAdminSecurityController',
  21. securityEnabledBinding: 'App.router.mainAdminController.securityEnabled',
  22. isSubmitDisabled: false,
  23. getAddSecurityWizardStatus: function () {
  24. return App.db.getSecurityWizardStatus();
  25. },
  26. setAddSecurityWizardStatus: function (status) {
  27. App.db.setSecurityWizardStatus(status);
  28. },
  29. notifySecurityOff: false,
  30. notifySecurityAdd: false,
  31. notifySecurityOffPopup: function () {
  32. var self = this;
  33. if (!this.get('isSubmitDisabled')) {
  34. App.ModalPopup.show({
  35. header: Em.I18n.t('admin.security.disable.popup.header'),
  36. primary: 'OK',
  37. secondary: null,
  38. onPrimary: function () {
  39. App.router.transitionTo('disableSecurity');
  40. self.set('isSubmitDisabled', true);
  41. this.hide();
  42. },
  43. bodyClass: Ember.View.extend({
  44. template: Ember.Handlebars.compile('<h5>{{t admin.security.disable.popup.body}}</h5>')
  45. })
  46. });
  47. }
  48. },
  49. notifySecurityAddPopup: function () {
  50. var self = this;
  51. App.ModalPopup.show({
  52. header: Em.I18n.t('admin.security.enable.popup.header'),
  53. primary: 'OK',
  54. secondary: null,
  55. onPrimary: function () {
  56. App.router.send('addSecurity');
  57. this.hide();
  58. },
  59. bodyClass: Ember.View.extend({
  60. template: Ember.Handlebars.compile('<h5>{{t admin.security.enable.popup.body}}</h5>')
  61. })
  62. });
  63. }
  64. });