Fix empty RBAC Forbidden message

This commit is contained in:
Cao Shufeng 2017-04-06 01:00:40 -04:00
parent b983cc76e1
commit 30844541d5

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