-
Notifications
You must be signed in to change notification settings - Fork 111
Assertion dependent on Authorization interface #326
Comments
Because you may want to use In next major version of ZfcRbac (v3) we will make // AuthorizationServiceInterface
public function isGranted(IdentityInterface $identity, $permission, $context = null);
// AssertionInterface
public function assert(IdentityInterface $identity, $permission, $context = null); That would solve your problem. Of course it makes |
Thanks for the answer @danizord. I do miss though a
How would I go about that with this implementation? Or is your An example for a resource dependent When will v3 be released? |
@danizord Can I find a preliminary version of v3 somewhere? Or a develop branch? |
Actually, what you call resource is the
There is the develop branch where @bakura10 did some work on 3.0. You can see some discussions and changes about 3.0 in issues and pull requests of milestone 3.0.0. Mainly #307. Unfornunately we are not using ZfcRbac in our current project so we are not having time to work on 3.0 for now 😢, but there are a lot of apps running in production with ZfcRbac and we will certainly use it in next projects that needs role based access control, so the repo is a bit without activity but the project is not dead :) Having said that, if you want to work on it, please feel free to open pull requests and discussions, I'm here to support you. |
@danizord For example a permission could be Thanks for the update. We have something working right now, I can see if I will propose some more PRs in this branch in the future. It is a pity that the work on the repository came to a halt. |
In ZfcRbac we don't have concept of "resources" like in ACL. In this case we tend to concatenate the subject and action in permission name: |
We are building a Rest API and are using an authorization module that is heavily inspired by
zfc-rbac
. One problem we ran into (and among the reasons why we had to make our own module) was that the assertions class (AssertionInterface
) takes anAuthorizationService
as an argument.The API is able to push resource representations of newly created resources to clients/users that are online.
Like this we keep the cached model on the client up to date.
These resources we push to the client(s) render with resource privileges/permissions and these can be different for each user. To render these privileges we need to use the assertions without an
AuthorizationService
(since the authenticated user (theIdentity
in theRoleService
set in theAuthorizationService
) is not who we are rendering for).Setting a different
$identity
in theRoleService
or setting anotherRoleService
instance in theAuthorizationService
during rendering felt very counter intuitive (and even dangerous).I considered instantiating a new
AuthorizationService
for the identity/user we are rendering for and use this instance only for rendering, but it felt very uncomfortable to create anAuthorizationService
merely for the purpose of rendering my resources with the correct privileges/permissions.In the end I ended up changing my assertion model and I made an
AssertionInterface
that takes$identity
(IdentityInterface
) as a parameter instead ofAuthorizationService
. This allowed me to use my assertions with other then the currently authenticatedIdentity
.So what it comes down to is I need to get information on privileges/permissions for a certain identity without having this identity authenticated (so intuitively I would say without an
AuthorizationService
for this Identity in my application).Why is the
AssertionInterface
actually taking anAuthorizationService
as an argument instead of anIdentity
?Any thoughts on this?
The text was updated successfully, but these errors were encountered: