router.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750
  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 misc = require('utils/misc');
  19. var App = require('app');
  20. App.WizardRoute = Em.Route.extend({
  21. gotoStep0: Em.Router.transitionTo('step0'),
  22. gotoStep1: Em.Router.transitionTo('step1'),
  23. gotoStep2: Em.Router.transitionTo('step2'),
  24. gotoStep3: Em.Router.transitionTo('step3'),
  25. gotoStep4: Em.Router.transitionTo('step4'),
  26. gotoStep5: Em.Router.transitionTo('step5'),
  27. gotoStep6: Em.Router.transitionTo('step6'),
  28. gotoStep7: Em.Router.transitionTo('step7'),
  29. gotoStep8: Em.Router.transitionTo('step8'),
  30. gotoStep9: Em.Router.transitionTo('step9'),
  31. gotoStep10: Em.Router.transitionTo('step10'),
  32. isRoutable: function() {
  33. return (typeof this.get('route') === 'string' && App.router.get('loggedIn'));
  34. }.property('App.router.loggedIn')
  35. });
  36. App.Router = Em.Router.extend({
  37. enableLogging: true,
  38. isFwdNavigation: true,
  39. backBtnForHigherStep: false,
  40. transitionInProgress: false,
  41. /**
  42. * Path for local login page. This page will be always accessible without
  43. * redirect to auth server different from ambari-server. Used in some types of
  44. * authorizations like knox sso.
  45. *
  46. * @type {string}
  47. */
  48. localUserAuthUrl: '/login/local',
  49. /**
  50. * LocalStorage property <code>redirectsCount</code> from <code>tmp</code> namespace
  51. * will be incremented by each redirect action performed by UI and reset on success login.
  52. * <code>redirectsLimitCount</code> determines maximum redirect tries. When redirects count overflow
  53. * then something goes wrong and we have to inform user about the problem.
  54. *
  55. * @type {number}
  56. */
  57. redirectsLimitCount: 0,
  58. /**
  59. * Is true, if cluster.provisioning_state is equal to 'INSTALLED'
  60. * @type {Boolean}
  61. */
  62. clusterInstallCompleted: false,
  63. /**
  64. * user prefered path to route
  65. */
  66. preferedPath: null,
  67. setNavigationFlow: function (step) {
  68. var matches = step.match(/\d+$/);
  69. var newStep;
  70. if (matches) {
  71. newStep = parseInt(matches[0]);
  72. }
  73. var previousStep = parseInt(this.getInstallerCurrentStep());
  74. this.set('isFwdNavigation', newStep >= previousStep);
  75. },
  76. clearAllSteps: function () {
  77. this.get('installerController').clear();
  78. this.get('addHostController').clear();
  79. this.get('addServiceController').clear();
  80. this.get('backgroundOperationsController').clear();
  81. for (var i = 1; i < 11; i++) {
  82. this.set('wizardStep' + i + 'Controller.hasSubmitted', false);
  83. this.set('wizardStep' + i + 'Controller.isDisabled', true);
  84. }
  85. },
  86. /**
  87. * Temporary fix for getting cluster name
  88. * @return {*}
  89. */
  90. getClusterName: function () {
  91. return App.router.get('clusterController').get('clusterName');
  92. },
  93. /**
  94. * Get current step of Installer wizard
  95. * @return {*}
  96. */
  97. getInstallerCurrentStep: function () {
  98. return this.getWizardCurrentStep('installer');
  99. },
  100. /**
  101. * Get current step for <code>wizardType</code> wizard
  102. * @param wizardType one of <code>installer</code>, <code>addHost</code>, <code>addServices</code>
  103. */
  104. getWizardCurrentStep: function (wizardType) {
  105. var currentStep = App.db.getWizardCurrentStep(wizardType);
  106. if (!currentStep) {
  107. currentStep = wizardType === 'installer' ? '0' : '1';
  108. }
  109. return currentStep;
  110. },
  111. /**
  112. * @type {boolean}
  113. */
  114. loggedIn: App.db.getAuthenticated(),
  115. loginName: function() {
  116. return this.getLoginName();
  117. }.property('loggedIn'),
  118. getAuthenticated: function () {
  119. var dfd = $.Deferred();
  120. var self = this;
  121. var auth = App.db.getAuthenticated();
  122. App.ajax.send({
  123. name: 'router.login.clusters',
  124. sender: this,
  125. success: 'onAuthenticationSuccess',
  126. error: 'onAuthenticationError'
  127. }).complete(function (xhr) {
  128. if (xhr.isResolved()) {
  129. // if server knows the user and user authenticated by UI
  130. if (auth) {
  131. dfd.resolve(self.get('loggedIn'));
  132. // if server knows the user but UI don't, check the response header
  133. // and try to authorize
  134. } else if (xhr.getResponseHeader('User')) {
  135. var user = xhr.getResponseHeader('User');
  136. App.ajax.send({
  137. name: 'router.login',
  138. sender: self,
  139. data: {
  140. usr: user,
  141. loginName: encodeURIComponent(user)
  142. },
  143. success: 'loginSuccessCallback',
  144. error: 'loginErrorCallback'
  145. });
  146. } else {
  147. self.setAuthenticated(false);
  148. dfd.resolve(false);
  149. }
  150. } else {
  151. //if provisioning state unreachable then consider user as unauthenticated
  152. self.setAuthenticated(false);
  153. dfd.resolve(false);
  154. }
  155. });
  156. return dfd.promise();
  157. },
  158. /**
  159. * Response for <code>/clusters?fields=Clusters/provisioning_state</code>
  160. * @type {null|object}
  161. */
  162. clusterData: null,
  163. onAuthenticationSuccess: function (data) {
  164. if (App.db.getAuthenticated() === true) {
  165. this.set('clusterData', data);
  166. this.setAuthenticated(true);
  167. if (data.items.length) {
  168. this.setClusterInstalled(data);
  169. }
  170. }
  171. },
  172. /**
  173. * If authentication failed, need to check for jwt auth url
  174. * and redirect user if current location is not <code>localUserAuthUrl</code>
  175. *
  176. * @param {?object} data
  177. */
  178. onAuthenticationError: function (data) {
  179. if (data.status === 403) {
  180. try {
  181. var responseJson = JSON.parse(data.responseText);
  182. if (responseJson.jwtProviderUrl && this.get('location.lastSetURL') !== this.get('localUserAuthUrl')) {
  183. this.redirectByURL(responseJson.jwtProviderUrl + encodeURIComponent(this.getCurrentLocationUrl()));
  184. }
  185. } catch (e) {
  186. } finally {
  187. this.setAuthenticated(false);
  188. }
  189. }
  190. },
  191. setAuthenticated: function (authenticated) {
  192. App.db.setAuthenticated(authenticated);
  193. this.set('loggedIn', authenticated);
  194. },
  195. getLoginName: function () {
  196. return App.db.getLoginName();
  197. },
  198. setLoginName: function (loginName) {
  199. App.db.setLoginName(loginName);
  200. },
  201. /**
  202. * Set user model to local storage
  203. * @param user
  204. */
  205. setUser: function (user) {
  206. App.db.setUser(user);
  207. },
  208. /**
  209. * Get user model from local storage
  210. * @return {*}
  211. */
  212. getUser: function () {
  213. return App.db.getUser();
  214. },
  215. setUserLoggedIn: function(userName) {
  216. this.setAuthenticated(true);
  217. this.setLoginName(userName);
  218. this.setUser(App.User.find().findProperty('id', userName));
  219. App.db.set('tmp', 'redirectsCount', 0);
  220. },
  221. /**
  222. * Set `clusterInstallCompleted` property based on cluster info response.
  223. *
  224. * @param {Object} clusterObject
  225. **/
  226. setClusterInstalled: function(clusterObject) {
  227. this.set('clusterInstallCompleted', clusterObject.items[0].Clusters.provisioning_state === 'INSTALLED')
  228. },
  229. login: function () {
  230. var controller = this.get('loginController');
  231. var loginName = controller.get('loginName');
  232. controller.set('loginName', loginName);
  233. var hash = misc.utf8ToB64(loginName + ":" + controller.get('password'));
  234. var usr = '';
  235. if (App.get('testMode')) {
  236. if (loginName === "admin" && controller.get('password') === 'admin') {
  237. usr = 'admin';
  238. } else if (loginName === 'user' && controller.get('password') === 'user') {
  239. usr = 'user';
  240. }
  241. }
  242. App.ajax.send({
  243. name: 'router.login',
  244. sender: this,
  245. data: {
  246. auth: "Basic " + hash,
  247. usr: usr,
  248. loginName: encodeURIComponent(loginName)
  249. },
  250. beforeSend: 'authBeforeSend',
  251. success: 'loginSuccessCallback',
  252. error: 'loginErrorCallback'
  253. });
  254. },
  255. authBeforeSend: function(opt, xhr, data) {
  256. xhr.setRequestHeader("Authorization", data.auth);
  257. },
  258. loginSuccessCallback: function(data, opt, params) {
  259. App.router.set('loginController.isSubmitDisabled', false);
  260. App.usersMapper.map({"items": [data]});
  261. this.setUserLoggedIn(decodeURIComponent(params.loginName));
  262. var requestData = {
  263. loginName: params.loginName,
  264. loginData: data
  265. };
  266. // no need to load cluster data if it's already loaded
  267. if (this.get('clusterData')) {
  268. this.loginGetClustersSuccessCallback(this.get('clusterData'), {}, requestData);
  269. }
  270. else {
  271. App.ajax.send({
  272. name: 'router.login.clusters',
  273. sender: this,
  274. data: requestData,
  275. success: 'loginGetClustersSuccessCallback'
  276. });
  277. }
  278. },
  279. loginErrorCallback: function(request) {
  280. var controller = this.get('loginController');
  281. this.setAuthenticated(false);
  282. if (request.status == 403) {
  283. var responseMessage = request.responseText;
  284. try{
  285. responseMessage = JSON.parse(request.responseText).message;
  286. }catch(e){}
  287. controller.postLogin(true, false, responseMessage);
  288. } else {
  289. controller.postLogin(false, false, null);
  290. }
  291. },
  292. /**
  293. * success callback of login request
  294. * @param {object} clustersData
  295. * @param {object} opt
  296. * @param {object} params
  297. */
  298. loginGetClustersSuccessCallback: function (clustersData, opt, params) {
  299. var privileges = params.loginData.privileges || [];
  300. var router = this;
  301. var isAdmin = privileges.mapProperty('PrivilegeInfo.permission_name').contains('AMBARI.ADMINISTRATOR');
  302. App.set('isAdmin', isAdmin);
  303. if (clustersData.items.length) {
  304. var clusterPermissions = privileges.
  305. filterProperty('PrivilegeInfo.cluster_name', clustersData.items[0].Clusters.cluster_name).
  306. mapProperty('PrivilegeInfo.permission_name');
  307. //cluster installed
  308. router.setClusterInstalled(clustersData);
  309. if (clusterPermissions.contains('CLUSTER.ADMINISTRATOR')) {
  310. App.setProperties({
  311. isAdmin: true,
  312. isOperator: true
  313. });
  314. }
  315. if (isAdmin || clusterPermissions.contains('CLUSTER.USER') || clusterPermissions.contains('CLUSTER.ADMINISTRATOR')) {
  316. router.transitionToApp();
  317. } else {
  318. router.transitionToViews();
  319. }
  320. } else {
  321. if (isAdmin) {
  322. router.transitionToAdminView();
  323. } else {
  324. router.transitionToViews();
  325. }
  326. }
  327. App.set('isPermissionDataLoaded', true);
  328. App.router.get('userSettingsController').dataLoading();
  329. },
  330. /**
  331. * redirect user to Admin View
  332. * @returns {$.ajax}
  333. */
  334. transitionToAdminView: function() {
  335. return App.ajax.send({
  336. name: 'ambari.service.load_server_version',
  337. sender: this,
  338. success: 'adminViewInfoSuccessCallback',
  339. error: 'adminViewInfoErrorCallback'
  340. });
  341. },
  342. /**
  343. * redirect user to application Dashboard
  344. */
  345. transitionToApp: function () {
  346. var router = this;
  347. if (!router.restorePreferedPath()) {
  348. router.getSection(function (route) {
  349. router.transitionTo(route);
  350. });
  351. }
  352. },
  353. /**
  354. * redirect user to application Views
  355. */
  356. transitionToViews: function() {
  357. App.router.get('mainViewsController').loadAmbariViews();
  358. this.transitionTo('main.views.index');
  359. },
  360. adminViewInfoSuccessCallback: function(data) {
  361. var components = Em.get(data,'components');
  362. if (Em.isArray(components)) {
  363. var mappedVersions = components.map(function(component) {
  364. if (Em.get(component, 'RootServiceComponents.component_version')) {
  365. return Em.get(component, 'RootServiceComponents.component_version');
  366. }
  367. }),
  368. sortedMappedVersions = mappedVersions.sort(),
  369. latestVersion = sortedMappedVersions[sortedMappedVersions.length-1];
  370. window.location.replace('/views/ADMIN_VIEW/' + latestVersion + '/INSTANCE/#/');
  371. }
  372. },
  373. adminViewInfoErrorCallback: function() {
  374. this.transitionToViews();
  375. },
  376. getSection: function (callback) {
  377. if (App.get('testMode')) {
  378. if (App.alwaysGoToInstaller) {
  379. callback('installer');
  380. } else {
  381. callback('main.dashboard.index');
  382. }
  383. } else {
  384. if (this.get('clusterInstallCompleted')) {
  385. App.router.get('wizardWatcherController').getUser().complete(function() {
  386. App.clusterStatus.updateFromServer(false).complete(function () {
  387. var route = 'main.dashboard.index';
  388. var clusterStatusOnServer = App.clusterStatus.get('value');
  389. if (clusterStatusOnServer) {
  390. var wizardControllerRoutes = require('data/controller_route');
  391. var wizardControllerRoute = wizardControllerRoutes.findProperty('wizardControllerName', clusterStatusOnServer.wizardControllerName);
  392. if (wizardControllerRoute && !App.router.get('wizardWatcherController').get('isNonWizardUser')) {
  393. route = wizardControllerRoute.route;
  394. }
  395. }
  396. if (wizardControllerRoute && wizardControllerRoute.wizardControllerName === 'mainAdminStackAndUpgradeController') {
  397. var clusterController = App.router.get('clusterController');
  398. clusterController.loadClusterName().done(function(){
  399. clusterController.restoreUpgradeState().done(function(){
  400. callback(route);
  401. });
  402. });
  403. } else {
  404. callback(route);
  405. }
  406. });
  407. });
  408. } else {
  409. callback('installer');
  410. }
  411. }
  412. },
  413. logOff: function (context) {
  414. var self = this;
  415. $('title').text(Em.I18n.t('app.name'));
  416. App.router.get('mainController').stopPolling();
  417. // App.db.cleanUp() must be called before router.clearAllSteps().
  418. // otherwise, this.set('installerController.currentStep, 0) would have no effect
  419. // since it's a computed property but we are not setting it as a dependent of App.db.
  420. App.db.cleanUp();
  421. App.setProperties({
  422. isAdmin: false,
  423. isOperator: false,
  424. isPermissionDataLoaded: false
  425. });
  426. this.set('loggedIn', false);
  427. this.clearAllSteps();
  428. this.set('loginController.loginName', '');
  429. this.set('loginController.password', '');
  430. // When logOff is called by Sign Out button, context contains event object. As it is only case we should send logoff request, we are checking context below.
  431. if (!App.get('testMode') && context) {
  432. App.ajax.send({
  433. name: 'router.logoff',
  434. sender: this,
  435. success: 'logOffSuccessCallback',
  436. error: 'logOffErrorCallback'
  437. }).complete(function() {
  438. self.logoffRedirect(context);
  439. });
  440. } else {
  441. this.logoffRedirect();
  442. }
  443. },
  444. logOffSuccessCallback: function () {
  445. var applicationController = App.router.get('applicationController');
  446. applicationController.set('isPollerRunning', false);
  447. },
  448. logOffErrorCallback: function () {
  449. },
  450. /**
  451. * Redirect function on sign off request.
  452. *
  453. * @param {$.Event} [context=undefined] - triggered event context
  454. */
  455. logoffRedirect: function(context) {
  456. if (App.router.get('clusterController.isLoaded')) {
  457. window.location.reload();
  458. } else {
  459. this.transitionTo('login', context);
  460. }
  461. },
  462. /**
  463. * save prefered path
  464. * @param {string} path
  465. * @param {string} key
  466. */
  467. savePreferedPath: function(path, key) {
  468. if (key) {
  469. if (path.contains(key)) {
  470. this.set('preferedPath', path.slice(path.indexOf(key) + key.length));
  471. }
  472. } else {
  473. this.set('preferedPath', path);
  474. }
  475. },
  476. /**
  477. * If path exist route to it, otherwise return false
  478. * @returns {boolean}
  479. */
  480. restorePreferedPath: function() {
  481. var preferredPath = this.get('preferedPath');
  482. var isRestored = false;
  483. if (preferredPath) {
  484. // If the preferred path is relative, allow a redirect to it.
  485. // If the path is not relative, silently ignore it - if the path is an absolute URL, the user
  486. // may be routed to a different server where the possibility exists for a phishing attack.
  487. if ((preferredPath.startsWith('/') || preferredPath.startsWith('#')) && !preferredPath.contains('#/login')) {
  488. window.location = preferredPath;
  489. isRestored = true;
  490. }
  491. // Unset preferedPath
  492. this.set('preferedPath', null);
  493. }
  494. return isRestored;
  495. },
  496. /**
  497. * initialize isAdmin if user is administrator
  498. */
  499. initAdmin: function(){
  500. if (App.db) {
  501. var user = App.db.getUser();
  502. if (user) {
  503. if (user.admin) {
  504. App.set('isAdmin', true);
  505. }
  506. if (user.operator) {
  507. App.set('isOperator', true);
  508. }
  509. App.set('isPermissionDataLoaded', true);
  510. }
  511. }
  512. },
  513. /**
  514. * Increment redirect count if <code>redirected</code> parameter passed.
  515. */
  516. handleUIRedirect: function() {
  517. if (/(\?|&)redirected=/.test(location.hash)) {
  518. var redirectsCount = App.db.get('tmp', 'redirectsCount') || 0;
  519. App.db.set('tmp', 'redirectsCount', ++redirectsCount);
  520. }
  521. },
  522. /**
  523. * <code>window.location</code> setter. Will add query param which determines that we redirect user
  524. * @param {string} url - url to navigate
  525. */
  526. redirectByURL: function(url) {
  527. var suffix = "?redirected=true";
  528. var redirectsCount = App.db.get('tmp', 'redirectsCount') || 0;
  529. if (redirectsCount > this.get('redirectsLimitCount')) {
  530. this.showRedirectIssue();
  531. return;
  532. }
  533. // skip adding redirected parameter if added
  534. if (/(\?|&)redirected=/.test(location.hash)) {
  535. this.setLocationUrl(url);
  536. return;
  537. }
  538. // detect if query params were assigned and replace "?" with "&" for suffix param
  539. if (/\?\w+=/.test(location.hash)) {
  540. suffix = suffix.replace('?', '&');
  541. }
  542. this.setLocationUrl(url + suffix);
  543. },
  544. /**
  545. * Convenient method to set <code>window.location</code>.
  546. * Useful for faking url manipulation in tests.
  547. *
  548. * @param {string} url
  549. */
  550. setLocationUrl: function(url) {
  551. window.location = url;
  552. },
  553. /**
  554. * Convenient method to get current <code>window.location</code>.
  555. * Useful for faking url manipulation in tests.
  556. */
  557. getCurrentLocationUrl: function() {
  558. return window.location.href;
  559. },
  560. /**
  561. * Inform user about redirect issue in modal popup.
  562. *
  563. * @returns {App.ModalPopup}
  564. */
  565. showRedirectIssue: function() {
  566. var bodyMessage = Em.I18n.t('app.redirectIssuePopup.body').format(location.origin + '/#' + this.get('localUserAuthUrl'));
  567. var popupHeader = Em.I18n.t('app.redirectIssuePopup.header');
  568. var popup = App.showAlertPopup(popupHeader, bodyMessage);
  569. popup.set('encodeBody', false);
  570. return popup;
  571. },
  572. root: Em.Route.extend({
  573. index: Em.Route.extend({
  574. route: '/',
  575. redirectsTo: 'login'
  576. }),
  577. enter: function(router){
  578. router.initAdmin();
  579. router.handleUIRedirect();
  580. },
  581. login: Em.Route.extend({
  582. route: '/login:suffix',
  583. /**
  584. * If the user is already logged in, redirect to where the user was previously
  585. */
  586. enter: function (router, context) {
  587. var location = router.location.location.hash;
  588. router.getAuthenticated().done(function (loggedIn) {
  589. if (loggedIn) {
  590. Ember.run.next(function () {
  591. router.getSection(function (route) {
  592. router.transitionTo(route, context);
  593. });
  594. });
  595. } else {
  596. //key to parse URI for prefered path to route
  597. router.savePreferedPath(location, '?targetURI=');
  598. }
  599. });
  600. },
  601. connectOutlets: function (router, context) {
  602. $('title').text(Em.I18n.t('app.name'));
  603. router.get('applicationController').connectOutlet('login');
  604. },
  605. serialize: function(router, context) {
  606. // check for login/local hash
  607. var location = router.get('location.location.hash');
  608. return {
  609. suffix: location === '#' + router.get('localUserAuthUrl') ? '/local' : ''
  610. };
  611. }
  612. }),
  613. installer: require('routes/installer'),
  614. main: require('routes/main'),
  615. adminView: Em.Route.extend({
  616. route: '/adminView',
  617. enter: function (router) {
  618. if (!router.get('loggedIn') || !App.isAccessible('upgrade_ADMIN') || App.isAccessible('upgrade_OPERATOR')) {
  619. Em.run.next(function () {
  620. router.transitionTo('login');
  621. });
  622. } else {
  623. App.ajax.send({
  624. name: 'ambari.service.load_server_version',
  625. sender: router,
  626. success: 'adminViewInfoSuccessCallback'
  627. });
  628. }
  629. }
  630. }),
  631. experimental: Em.Route.extend({
  632. route: '/experimental',
  633. enter: function (router, context) {
  634. if (App.isAccessible('upgrade_OPERATOR')) {
  635. Em.run.next(function () {
  636. if (router.get('clusterInstallCompleted')) {
  637. router.transitionTo("main.dashboard.widgets");
  638. } else {
  639. router.route("installer");
  640. }
  641. });
  642. } else if (!App.isAccessible('upgrade_ADMIN')) {
  643. Em.run.next(function () {
  644. router.transitionTo("main.views.index");
  645. });
  646. }
  647. },
  648. connectOutlets: function (router, context) {
  649. if (App.isAccessible('upgrade_ONLY_ADMIN')) {
  650. App.router.get('experimentalController').loadSupports().complete(function () {
  651. $('title').text(Em.I18n.t('app.name.subtitle.experimental'));
  652. router.get('applicationController').connectOutlet('experimental');
  653. });
  654. }
  655. }
  656. }),
  657. logoff: function (router, context) {
  658. router.logOff(context);
  659. }
  660. })
  661. });