sitepoint-editors / Rauth

A basic annotation-based ACL package for PHP
MIT License
41 stars 4 forks source link

[Feature] Inheritance #7

Open Swader opened 8 years ago

Swader commented 8 years ago

Given a class with the docblock:

/**
 * Class ExampleClass
 * @package SitePoint\tests
 *
 * @auth-groups admin, reg-user,fools
 * @auth-permissions cook,clean, harvest
 */

and its method with the docblock:

    /**
     * @auth-groups foo, bar, baz
     * @auth-mode NONE
     */

should Rauth see the method's docblock as it is, or inherited and extended by the class, like so?

    /**
     * @auth-groups foo, bar, baz
     * @auth-permissions cook,clean, harvest
     * @auth-mode NONE
     */

In other words, should method auth tags inherit and overwrite class tags, or should a method's auth directives be isolated?

Furgas commented 8 years ago

Maybe inherit only when @auth-inherit is present?

Swader commented 8 years ago

That's definitely an option.

The question now is what people consider to be the default state - inherit by default, or don't? In other words, do users explicitly disable, or enable inheritance?

Furgas commented 8 years ago

Well, I guess it's a matter of preference. I would go with:

Swader commented 8 years ago

Sounds good. I'll mull it over and get some more opinions in, but in general that's what I'd go with, too.