mirror of
https://github.com/ansible/awx.git
synced 2026-03-07 11:41:08 -03:30
Only allow user with super_user access to see activity stream button. Fixed collision between is_superuser rootscope variable and credential.is_superuser on credential detail page. Added AS to user/n/permissions page.
This commit is contained in:
@@ -301,7 +301,7 @@ angular.module('ansible', [
|
|||||||
}
|
}
|
||||||
CheckLicense();
|
CheckLicense();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Make the correct tab active
|
// Make the correct tab active
|
||||||
var base = $location.path().replace(/^\//,'').split('/')[0];
|
var base = $location.path().replace(/^\//,'').split('/')[0];
|
||||||
if (base == '') {
|
if (base == '') {
|
||||||
@@ -319,6 +319,10 @@ angular.module('ansible', [
|
|||||||
$cookieStore.put('sessionExpired', false);
|
$cookieStore.put('sessionExpired', false);
|
||||||
$location.path('/login');
|
$location.path('/login');
|
||||||
}
|
}
|
||||||
|
else {
|
||||||
|
// If browser refresh, set the user_is_superuser value
|
||||||
|
$rootScope['user_is_superuser'] = Authorization.getUserInfo('is_superuser');
|
||||||
|
}
|
||||||
|
|
||||||
// If browser refresh, activate the correct tab
|
// If browser refresh, activate the correct tab
|
||||||
var base = ($location.path().replace(/^\//,'').split('/')[0]);
|
var base = ($location.path().replace(/^\//,'').split('/')[0]);
|
||||||
|
|||||||
@@ -96,6 +96,7 @@ function Authenticate($cookieStore, $window, $scope, $rootScope, $location, Auth
|
|||||||
Authorization.getUser()
|
Authorization.getUser()
|
||||||
.success(function(data, status, headers, config) {
|
.success(function(data, status, headers, config) {
|
||||||
Authorization.setUserInfo(data);
|
Authorization.setUserInfo(data);
|
||||||
|
$rootScope['user_is_superuser'] = data.results[0].is_superuser;
|
||||||
Authorization.getLicense()
|
Authorization.getLicense()
|
||||||
.success(function(data, status, headers, config) {
|
.success(function(data, status, headers, config) {
|
||||||
Authorization.setLicense(data['license_info']);
|
Authorization.setLicense(data['license_info']);
|
||||||
|
|||||||
@@ -208,6 +208,10 @@ function UsersEdit ($scope, $rootScope, $compile, $location, $log, $routeParams,
|
|||||||
var scope = generator.inject(form, {mode: 'edit', related: true});
|
var scope = generator.inject(form, {mode: 'edit', related: true});
|
||||||
generator.reset();
|
generator.reset();
|
||||||
|
|
||||||
|
if (scope.removePostRefresh) {
|
||||||
|
scope.removePostRefresh();
|
||||||
|
}
|
||||||
|
|
||||||
scope.PermissionAddAllowed = false;
|
scope.PermissionAddAllowed = false;
|
||||||
|
|
||||||
// After the Organization is loaded, retrieve each related set
|
// After the Organization is loaded, retrieve each related set
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ angular.module('CredentialFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ angular.module('InventoryFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -112,7 +112,8 @@ angular.module('InventoryHostsFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ angular.module('JobTemplateFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -23,7 +23,8 @@ angular.module('OrganizationFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -16,6 +16,17 @@ angular.module('PermissionFormDefinition', [])
|
|||||||
name: 'permission', //entity or model name in singular form
|
name: 'permission', //entity or model name in singular form
|
||||||
well: true, //Wrap the form with TB well/
|
well: true, //Wrap the form with TB well/
|
||||||
|
|
||||||
|
stream: {
|
||||||
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
dataPlacement: "top",
|
||||||
|
icon: "icon-comments-alt",
|
||||||
|
mode: 'edit',
|
||||||
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
|
},
|
||||||
|
|
||||||
fields: {
|
fields: {
|
||||||
category: {
|
category: {
|
||||||
label: 'Permission Type',
|
label: 'Permission Type',
|
||||||
|
|||||||
@@ -25,7 +25,8 @@ angular.module('ProjectFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ angular.module('TeamFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -24,7 +24,8 @@ angular.module('UserFormDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'edit',
|
mode: 'edit',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -69,7 +69,8 @@ angular.module('CredentialsListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -117,7 +117,8 @@ angular.module('HomeGroupListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ angular.module('HomeHostListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -96,7 +96,8 @@ angular.module('InventoriesListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -143,7 +143,8 @@ angular.module('InventorySummaryDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -45,7 +45,8 @@ angular.module('JobTemplatesListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -52,7 +52,8 @@ angular.module('OrganizationListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -50,6 +50,16 @@ angular.module('PermissionListDefinition', [])
|
|||||||
"class": 'btn-success btn-xs',
|
"class": 'btn-success btn-xs',
|
||||||
awToolTip: 'Add a new permission',
|
awToolTip: 'Add a new permission',
|
||||||
ngShow: 'PermissionAddAllowed'
|
ngShow: 'PermissionAddAllowed'
|
||||||
|
},
|
||||||
|
stream: {
|
||||||
|
'class': "btn-primary btn-xs activity-btn",
|
||||||
|
ngClick: "showActivity()",
|
||||||
|
awToolTip: "View Activity Stream",
|
||||||
|
dataPlacement: "top",
|
||||||
|
icon: "icon-comments-alt",
|
||||||
|
mode: 'all',
|
||||||
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -88,7 +88,8 @@ angular.module('ProjectsListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ angular.module('TeamsListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -50,7 +50,8 @@ angular.module('UserListDefinition', [])
|
|||||||
dataPlacement: "top",
|
dataPlacement: "top",
|
||||||
icon: "icon-comments-alt",
|
icon: "icon-comments-alt",
|
||||||
mode: 'all',
|
mode: 'all',
|
||||||
iconSize: 'large'
|
iconSize: 'large',
|
||||||
|
ngShow: "user_is_superuser"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|
||||||
|
|||||||
@@ -8,7 +8,7 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefinition', 'SearchHelper', 'PaginateHelper',
|
angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefinition', 'SearchHelper', 'PaginateHelper',
|
||||||
'RefreshHelper', 'ListGenerator', 'StreamWidget'])
|
'RefreshHelper', 'ListGenerator', 'StreamWidget', 'AuthService'])
|
||||||
|
|
||||||
.factory('setStreamHeight', [ function() {
|
.factory('setStreamHeight', [ function() {
|
||||||
return function() {
|
return function() {
|
||||||
@@ -20,7 +20,7 @@ angular.module('StreamWidget', ['RestServices', 'Utilities', 'StreamListDefiniti
|
|||||||
}
|
}
|
||||||
}])
|
}])
|
||||||
|
|
||||||
.factory('ShowStream', [ 'setStreamHeight', function(setStreamHeight) {
|
.factory('ShowStream', [ 'setStreamHeight', 'Authorization', function(setStreamHeight, Authorization) {
|
||||||
return function() {
|
return function() {
|
||||||
// Slide in the Stream widget
|
// Slide in the Stream widget
|
||||||
|
|
||||||
|
|||||||
@@ -104,7 +104,7 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
|
|||||||
setUserInfo: function(response) {
|
setUserInfo: function(response) {
|
||||||
// store the response values in $rootScope so we can get to them later
|
// store the response values in $rootScope so we can get to them later
|
||||||
$rootScope.current_user = response.results[0];
|
$rootScope.current_user = response.results[0];
|
||||||
$cookieStore.put('current_user', response.results[0]); //keep in session cookie incase user hits refresh
|
$cookieStore.put('current_user', response.results[0]); //keep in session cookie in the event of browser refresh
|
||||||
},
|
},
|
||||||
|
|
||||||
restoreUserInfo: function() {
|
restoreUserInfo: function() {
|
||||||
@@ -113,7 +113,14 @@ angular.module('AuthService', ['ngCookies', 'Utilities'])
|
|||||||
|
|
||||||
getUserInfo: function(key) {
|
getUserInfo: function(key) {
|
||||||
// Access values returned from the Me API call
|
// Access values returned from the Me API call
|
||||||
return ($rootScope.current_user[key]) ? $rootScope.current_user[key] : null;
|
if ($rootScope.current_user ) {
|
||||||
|
return $rootScope.current_user[key]
|
||||||
|
}
|
||||||
|
else {
|
||||||
|
this.restoreUserInfo();
|
||||||
|
var cu = $cookieStore.get('current_user');
|
||||||
|
return cu[key];
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}]);
|
}]);
|
||||||
|
|||||||
@@ -3,7 +3,7 @@
|
|||||||
<div class="col-lg-12">
|
<div class="col-lg-12">
|
||||||
<div class="list-actions pull-right">
|
<div class="list-actions pull-right">
|
||||||
<button type="button" class="btn btn-primary btn-xs refresh-btn" ng-click="refresh()" id="refresh_btn" aw-tool-tip="Refresh page" data-placement="top"><i class="icon-refresh icon-large"></i></button>
|
<button type="button" class="btn btn-primary btn-xs refresh-btn" ng-click="refresh()" id="refresh_btn" aw-tool-tip="Refresh page" data-placement="top"><i class="icon-refresh icon-large"></i></button>
|
||||||
<button type="button" class="btn btn-primary btn-xs activity-btn" ng-click="showActivity()" id="activity_btn" aw-tool-tip="View activity stream" data-placement="top"><i class="icon-comments-alt icon-large"></i></button>
|
<button type="button" class="btn btn-primary btn-xs activity-btn" ng-click="showActivity()" id="activity_btn" aw-tool-tip="View activity stream" data-placement="top" ng-show="user_is_superuser"><i class="icon-comments-alt icon-large"></i></button>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|||||||
Reference in New Issue
Block a user