Merge pull request #43375 from CaoShuFeng/forbiddenMessage

Automatic merge from submit-queue

Fix empty RBAC Forbidden message

Fix empty RBAC Forbidden message when accessing cluster scope resources.
**Release note**:

```NONE
```
This commit is contained in:
Kubernetes Submit Queue 2017-04-08 09:02:19 -07:00 committed by GitHub
commit 6d7e6c74c9

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