[#69] object/acl: Change basic ACL type in requestInfo
Signed-off-by: Leonard Lyubich <leonard@nspcc.ru>
This commit is contained in:
parent
30e6912c7b
commit
0f52444ae9
1 changed files with 6 additions and 9 deletions
|
@ -38,7 +38,7 @@ type (
|
||||||
}
|
}
|
||||||
|
|
||||||
requestInfo struct {
|
requestInfo struct {
|
||||||
basicACL uint32
|
basicACL basicACLHelper
|
||||||
requestRole acl.Role
|
requestRole acl.Role
|
||||||
operation acl.Operation // put, get, head, etc.
|
operation acl.Operation // put, get, head, etc.
|
||||||
owner *owner.ID // container owner
|
owner *owner.ID // container owner
|
||||||
|
@ -340,7 +340,7 @@ func (b Service) findRequestInfo(
|
||||||
verb := sourceVerbOfRequest(req, op)
|
verb := sourceVerbOfRequest(req, op)
|
||||||
// todo: check verb sanity, if it was generated correctly. Do we need it ?
|
// todo: check verb sanity, if it was generated correctly. Do we need it ?
|
||||||
|
|
||||||
info.basicACL = cnr.GetBasicACL()
|
info.basicACL = basicACLHelper(cnr.GetBasicACL())
|
||||||
info.requestRole = role
|
info.requestRole = role
|
||||||
info.operation = verb
|
info.operation = verb
|
||||||
info.owner = owner.NewIDFromV2(cnr.GetOwnerID())
|
info.owner = owner.NewIDFromV2(cnr.GetOwnerID())
|
||||||
|
@ -398,18 +398,16 @@ func getObjectOwnerFromMessage(req interface{}) (id *owner.ID, err error) {
|
||||||
|
|
||||||
// main check function for basic ACL
|
// main check function for basic ACL
|
||||||
func basicACLCheck(info requestInfo) bool {
|
func basicACLCheck(info requestInfo) bool {
|
||||||
rule := basicACLHelper(info.basicACL)
|
|
||||||
|
|
||||||
// check basic ACL permissions
|
// check basic ACL permissions
|
||||||
var checkFn func(acl.Operation) bool
|
var checkFn func(acl.Operation) bool
|
||||||
|
|
||||||
switch info.requestRole {
|
switch info.requestRole {
|
||||||
case acl.RoleUser:
|
case acl.RoleUser:
|
||||||
checkFn = rule.UserAllowed
|
checkFn = info.basicACL.UserAllowed
|
||||||
case acl.RoleSystem:
|
case acl.RoleSystem:
|
||||||
checkFn = rule.SystemAllowed
|
checkFn = info.basicACL.SystemAllowed
|
||||||
case acl.RoleOthers:
|
case acl.RoleOthers:
|
||||||
checkFn = rule.OthersAllowed
|
checkFn = info.basicACL.OthersAllowed
|
||||||
default:
|
default:
|
||||||
// log there
|
// log there
|
||||||
return false
|
return false
|
||||||
|
@ -423,8 +421,7 @@ func stickyBitCheck(info requestInfo, owner *owner.ID) bool {
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
rule := basicACLHelper(info.basicACL)
|
if !info.basicACL.Sticky() {
|
||||||
if !rule.Sticky() {
|
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue