kerberos.js 3.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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.MainAdminKerberosController = Em.Controller.extend({
  20. name: 'mainAdminKerberosController',
  21. securityEnabled: false,
  22. dataIsLoaded: false,
  23. isRecommendedLoaded: true,
  24. getAddSecurityWizardStatus: function () {
  25. return App.db.getSecurityWizardStatus();
  26. },
  27. setAddSecurityWizardStatus: function (status) {
  28. App.db.setSecurityWizardStatus(status);
  29. },
  30. setDisableSecurityStatus: function (status) {
  31. App.db.setDisableSecurityStatus(status);
  32. },
  33. getDisableSecurityStatus: function (status) {
  34. return App.db.getDisableSecurityStatus();
  35. },
  36. notifySecurityOff: false,
  37. notifySecurityAdd: false,
  38. notifySecurityOffPopup: function () {
  39. var self = this;
  40. App.ModalPopup.show({
  41. header: Em.I18n.t('popup.confirmation.commonHeader'),
  42. primary: Em.I18n.t('ok'),
  43. onPrimary: function () {
  44. App.db.setSecurityDeployCommands(undefined);
  45. self.setDisableSecurityStatus("RUNNING");
  46. App.router.transitionTo('disableSecurity');
  47. this.hide();
  48. },
  49. bodyClass: Ember.View.extend({
  50. isMapReduceInstalled: App.Service.find().mapProperty('serviceName').contains('MAPREDUCE'),
  51. templateName: require('templates/main/admin/security/notify_security_off_popup')
  52. })
  53. })
  54. },
  55. getUpdatedSecurityStatus: function () {
  56. this.setSecurityStatus();
  57. return this.get('securityEnabled');
  58. },
  59. startKerberosWizard: function () {
  60. this.setAddSecurityWizardStatus('RUNNING');
  61. App.router.transitionTo('adminAddKerberos');
  62. },
  63. /**
  64. * Loads the security status from server (security_enabled property in cluster-env configuration)
  65. */
  66. loadSecurityStatusFromServer: function () {
  67. if (App.get('testMode')) {
  68. this.set('securityEnabled', !App.get('testEnableSecurity'));
  69. this.set('dataIsLoaded', true);
  70. } else {
  71. //get Security Status From Server
  72. var self = this;
  73. var tags = [{siteName: 'cluster-env'}];
  74. App.router.get('configurationController').getConfigsByTags(tags).done(function (data) {
  75. var configs = data[0].properties;
  76. if (configs) {
  77. self.set('securityEnabled', configs['security_enabled'] === 'true');
  78. }
  79. self.set('dataIsLoaded', true);
  80. });
  81. }
  82. }
  83. });