First the user can have multiple roles at the same time, and the role has scope. For example, one user has three roles: /scopeA/editor, /scopeA/programmer, /scopeB/editor
and /scopeA/editor has access to resource /scopeA/post /scopeA/programmer has access to resource /scopeA/bug
/scopeB/editor has access to resource /scopeB/post
so the question comes:
how can i declare a policy saying: if there is a role named "/XX/editor" in the role bag, then the corresponding user has access to "/YY/post", when "XX == YY"
I found a similar question here, and i proposed a way to solve the problem, but when it comes to multiple role(the role attribute value is a bag), my answer is not right. Because the role attribute value is a bag, I cannot just get the part between the first two slashes of the role attribute value, and compare to that of the resource attribute,
then i tried to find a higher-order bag function to do this, the "urn:oasis:names:tc:xacml:3.0:function:any-of" function can do this, but what about the first "function argument" of the any-of function?
here is what i do: the first argument of the any-of function is "string-equal", and the second argument is a function used to get the part between the first two slashes of the resouce-id, the third argument is the attribute value of the subject which is a bag.
so all i need to do is to define a function to get the part between the first two slashes, right?
is there a better way to do what i want? if anything is unclear, plz let me know, thanks~~