Fix empty RBAC Forbidden message

Kubernetes-commit: 30844541d55b302b06bd85f12d8cf0193e7e4240
This commit is contained in:
Cao Shufeng 2017-04-06 01:00:40 -04:00 committed by Kubernetes Publisher
parent e8e8bbf610
commit d08e3dad61
1 changed files with 4 additions and 0 deletions

View File

@ -52,6 +52,10 @@ func forbiddenMessage(attributes authorizer.Attributes) string {
username = user.GetName()
}
if !attributes.IsResourceRequest() {
return fmt.Sprintf("User %q cannot %s path %q.", username, attributes.GetVerb(), attributes.GetPath())
}
resource := attributes.GetResource()
if group := attributes.GetAPIGroup(); len(group) > 0 {
resource = resource + "." + group