Skip to content

Hope to add a new feature: PermissionControl #7

@pigochu

Description

@pigochu

Orignal Yii has AccessControl that use in Controller behavior.

It's simple for us to control page permission.

I think yii-permission should be able to implement.

usage example in controller:

public function behaviors() {

    return [
       'permission' => PermissionControl::class
       'rules' => [
           'allow' => true,
           'actions' => ['index', 'view'],
           'enforce' => [
              'user' => \Yii::$app->user->identity->id, // map to $v0
              'obj' => 'data1', // map to $v1
              'dom' => 'domain1', // map to $v2 ?
              'act' => 'read', // map to $v3 ?
           ],
       ],
    ];
}

It will check current user can read domain1's data1 , then allow actions index and view.
$v0~$v5 can be alias in config for readable.

I don’t know if anyone can experiment with my wish 😍

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requesthelp wantedExtra attention is needed

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions