-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3060 from josefkarasek/bz1587807-archive-link
Fix wrong 'archiveLink' for operations user
- Loading branch information
Showing
8 changed files
with
241 additions
and
171 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
'use strict'; | ||
|
||
angular.module("openshiftConsole") | ||
.factory("AggregatedLoggingService", function($q, Logger, DataService) { | ||
|
||
// cache previous request | ||
var userAllowed; | ||
|
||
// Create SelfSubjectAccessReview request againt authorization API to check whether | ||
// current user can view pods/log from 'default' project. | ||
// Users who can view such logs are 'operations' users | ||
var isOperationsUser = function() { | ||
if (userAllowed !== undefined) { | ||
// Using cached data. | ||
Logger.log("AggregatedLoggingService, using cached user"); | ||
return $q.when(userAllowed); | ||
} | ||
Logger.log("AggregatedLoggingService, loading whether user is Operations user"); | ||
var ssar = { | ||
apiVersion: 'authorization.k8s.io/v1', | ||
kind: 'SelfSubjectAccessReview', | ||
spec: { | ||
resourceAttributes: { | ||
resource: 'pods/log', | ||
namespace: 'default', | ||
verb: 'view' | ||
} | ||
} | ||
}; | ||
return DataService.create({ group: 'authorization.k8s.io', version: 'v1', resource: 'selfsubjectaccessreviews'}, | ||
null, ssar, {namespace: 'default'}).then( | ||
function(data) { | ||
userAllowed = data.status.allowed; | ||
return userAllowed; | ||
}, function() { | ||
return false; | ||
}); | ||
}; | ||
|
||
return { | ||
isOperationsUser: isOperationsUser | ||
}; | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.