-
-
Notifications
You must be signed in to change notification settings - Fork 2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Acl Resource rename #13639
Comments
+1, especially about rethinking |
|
I still maintain this is confusing if not unnecessary, or maybe I’m missing something? Why do we need two interfaces? Anything that needs to be passed to |
@scrnjakovic I see your point. Let me talk to the core team and see whether we can remove the aware interface and what use case serves. With 4.x coming up, now is the time to do this. |
For me it's simple @scrnjakovic just check ResourceInterface, it has methods like getDescription etc. ResourceAware and RoleAware where implemented so you can for example do something like: class Article extends Model implements ResourceAware
{
public function getResourceName()
{
return 'article';
}
} class User extends Model implements RoleAware
{
public function getRoleName()
{
return 'user';
}
} And then do: $acl = new Memory();
$acl->addResource('article', ['update']);
$acl->allow('user', 'article', ['update']);
$article = Article::findFirst();
$user = User::findFirst();
$canUpdate = $acl->isAllowed($user, $article, 'update'); // will return result So pretty much Maybe we can figure something else, if you have any idea feel free to write it. I just don't see a good way to solve this issue. Also i don't think that merging two interfaces that are for totally different things will solve anything. I guess we can possibly do it somehow by just renaming methods in RoleInterface and ResourceInterface. |
To attempt to clarify, based on what I'm reading above, Is that accurate? Because if so, they do serve very distinct purposes. Though I'd probably argue, at that point, that |
Exactly this @danhunsaker but it's more like RoleAware/ResourceAware is representation of these Roles/Resources. |
Sorry for not catching the |
I suggest to rename
Resource
, because it's on soft reserved word of PHP.To rename:
Phalcon\Acl\Resource
(???)Phalcon\Acl\ResourceInterface
Phalcon\Acl\ResourceAware
(I doubt in the necessity of this class)Phalcon\Acl\Resource -> Phalcon\Acl\Subject
Phalcon\Acl\ResourceInterface -> Phalcon\Acl\SubjectInterface
Phalcon\Acl\ResourceAware -> Phalcon\Acl\SubjectAware
Phalcon\Acl\Role -> Phalcon\Acl\Operation
Phalcon\Acl\RoleInterface -> Phalcon\Acl\OperationInterface
Phalcon\Acl\RoleAware -> Phalcon\Acl\OperationAware
The text was updated successfully, but these errors were encountered: