Yii Framework Forum: Managed ACF - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Managed ACF

#1 User is offline   Knight Yoshi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 13-March 17

Posted 11 January 2018 - 11:26 PM

Is it possible to apply rules programmatically?

So in one of the examples
public function behaviors()
{
    return [
        'access' => [
            'class' => AccessControl::className(),
            'rules' => [
                [
                    'allow' => true,
                    'actions' => ['index'],
                    'roles' => ['managePost'],
                ],
                [
                    'allow' => true,
                    'actions' => ['view'],
                    'roles' => ['viewPost'],
                ],
                [
                    'allow' => true,
                    'actions' => ['create'],
                    'roles' => ['createPost'],
                ],
                [
                    'allow' => true,
                    'actions' => ['update'],
                    'roles' => ['updatePost'],
                ],
                [
                    'allow' => true,
                    'actions' => ['delete'],
                    'roles' => ['deletePost'],
                ],
            ],
        ],
    ];
}


Would it be possible to query the rules from the database, but do so at a higher level than for each individual controller?
0

#2 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,550
  • Joined: 16-February 11
  • Location:Japan

Posted 12 January 2018 - 06:54 AM

Probably you will find this extension very interesting:

mdmsoft/yii2-admin (https://github.com/mdmsoft/yii2-admin)

This is my favorite RBAC manager for Yii2. Among other things, I love the following features:

  • It supports a special kind of 'permission' - 'route' and an ACF component. You can manage RBAC and ACF in a unified way with this extension.
  • It allows you to develop your own user management system. It doesn't force you to use something integrated in this extension.

0

#3 User is offline   Knight Yoshi 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 57
  • Joined: 13-March 17

Posted 12 January 2018 - 11:42 AM

View Postsoftark, on 12 January 2018 - 06:54 AM, said:

Probably you will find this extension very interesting:

mdmsoft/yii2-admin (https://github.com/mdmsoft/yii2-admin)

This is my favorite RBAC manager for Yii2. Among other things, I love the following features:

  • It supports a special kind of 'permission' - 'route' and an ACF component. You can manage RBAC and ACF in a unified way with this extension.
  • It allows you to develop your own user management system. It doesn't force you to use something integrated in this extension.



Is it relatively easy to integrate? I'm working on an admin panel/CMS for my system. So having it exist within it's own interface is not ideal.
0

#4 User is offline   softark 

  • Keep It Simple
  • Yii
  • Group: Moderators
  • Posts: 3,550
  • Joined: 16-February 11
  • Location:Japan

Posted 12 January 2018 - 06:35 PM

Basic Configuration (https://github.com/m...onfiguration.md)

It has a set of pages that manage RBAC hierarchy (routes, permissions and roles). As I said, 'route' is used for ACF.
It also has a page that assign roles to the users. But it doesn't force you to use a specific User model. You can use your own User model that implements the IdentityInterface.

You may or may not use these pages for RBAC management and role assignment.
I prefer to use migrations for RBAC management, and want to have a custom page for role assignment within my own User management module.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users