From bcd1307b2e89202f822aedd55952cb99fd977426 Mon Sep 17 00:00:00 2001 From: Jared Tabor Date: Thu, 8 Jun 2017 09:20:51 -0700 Subject: [PATCH] removing CheckAccess module, stale code --- .../checkAccess.factory.js | 61 ------------------- .../src/login/authenticationServices/main.js | 2 - 2 files changed, 63 deletions(-) delete mode 100644 awx/ui/client/src/login/authenticationServices/checkAccess.factory.js diff --git a/awx/ui/client/src/login/authenticationServices/checkAccess.factory.js b/awx/ui/client/src/login/authenticationServices/checkAccess.factory.js deleted file mode 100644 index 2eb130d75c..0000000000 --- a/awx/ui/client/src/login/authenticationServices/checkAccess.factory.js +++ /dev/null @@ -1,61 +0,0 @@ -/************************************************* - * Copyright (c) 2015 Ansible, Inc. - * - * All Rights Reserved - *************************************************/ - - /** - * @ngdoc function - * @name helpers.function:Access - * @description routines checking user access -*/ - - -export default - ['$rootScope', 'Alert', 'Rest', 'ProcessErrors', '$cookies', - function ($rootScope, Alert, Rest, ProcessErrors, $cookies) { - return function (params) { - // set PermissionAddAllowed to true or false based on user access. admins and org admins are granted - // accesss. - var scope = params.scope, - callback = params.callback || undefined, - me; - - // uer may have refreshed the browser, in which case retrieve current user info from session cookie - me = ($rootScope.current_user) ? $rootScope.current_user : $cookies.getObject('current_user'); - - if (me.is_superuser) { - scope.PermissionAddAllowed = true; - if(callback){ - scope.$emit(callback); - } - } else { - if (me.related.admin_of_organizations) { - Rest.setUrl(me.related.admin_of_organizations); - Rest.get() - .success(function (data) { - if (data.results.length > 0) { - scope.PermissionAddAllowed = true; - } else { - scope.PermissionAddAllowed = false; - } - if(callback){ - scope.$emit(callback); - } - }) - .error(function (data, status) { - ProcessErrors(scope, data, status, null, { - hdr: 'Error!', - msg: 'Call to ' + me.related.admin_of_organizations + - ' failed. DELETE returned status: ' + status - }); - }); - } - } - - //if (!access) { - // Alert('Access Denied', 'You do not have access to this function. Please contact your system administrator.'); - //} - //return access; - }; - }]; diff --git a/awx/ui/client/src/login/authenticationServices/main.js b/awx/ui/client/src/login/authenticationServices/main.js index a7de90ecc7..11bb998710 100644 --- a/awx/ui/client/src/login/authenticationServices/main.js +++ b/awx/ui/client/src/login/authenticationServices/main.js @@ -5,7 +5,6 @@ *************************************************/ import authenticationService from './authentication.service'; -import checkAccess from './checkAccess.factory'; import isAdmin from './isAdmin.factory'; import timer from './timer.factory'; import pendoService from './pendo.service'; @@ -13,7 +12,6 @@ import pendoService from './pendo.service'; export default angular.module('authentication', []) .factory('Authorization', authenticationService) - .factory('CheckAccess', checkAccess) .factory('IsAdmin', isAdmin) .factory('Timer', timer) .service('pendoService', pendoService);