vova07 / yii2-start-rbac-module Goto Github PK
View Code? Open in Web Editor NEWThe RBAC module for Yii2-Start application.
The RBAC module for Yii2-Start application.
Primero muchas gracias por compartir el modulo, veo que esta configurado para PHPManager, el cual funciona genial, estoy revisando para colocarlo usando DBManager, la cree las tablas desde su sql, me falló algo en la migracion, podrias darme una vision general, seguire revisando hasta lograrlo, si puedes darme algo de apoyo/opinion sobre el tema, te lo agradecería
Saludos
BACKEND_RULES_INDEX_TITLE, BACKEND_ROLES_INDEX_TITLE => дсотупом
Здравствуйте, Василий.
Изучаю ваши модули. Возник вопрос по разрешениям.
по аналогии с Вашим классом в комментариях
https://github.com/vova07/yii2-start-comments-module/blob/master/commands/RbacController.php
, написал
class ArticleController extends Controller{
/**
* @inheritdoc
*/
public $defaultAction = 'add';
/**
* @var array Main module permission array
*/
public $mainPermission = [
'name' => 'administrateArticles',
'description' => 'Can administrate all "Articles" module'
];
/**
* @var array Permission
*/
public $permissions = [
'BViewArticles' => [
'description' => 'Can view backend articles list'
],
'BUpdateArticles' => [
'description' => 'Can update backend articles'
],
// more permissions
];
/**
* Add Articles RBAC.
*/
public function actionAdd()
{
$auth = Yii::$app->authManager;
$root = $auth->getRole('root');
// some code............................
return static::EXIT_CODE_NORMAL;
}
/**
* Remove articles RBAC.
*/
public function actionRemove()
{
$auth = Yii::$app->authManager;
$permissions = array_keys($this->permissions);
foreach ($permissions as $name => $option) {
$permission = $auth->getPermission($name);
//var_dump($permission); // тут показывает NULL
$auth->remove($permission);
}
$mainPermission = $auth->getPermission($this->mainPermission['name']);
$auth->remove($mainPermission);
return static::EXIT_CODE_NORMAL;
}
}
Exception 'yii\base\InvalidParamException' with message 'Removing unsupported object type.'
in \vendor\yiisoft\yii2\rbac\BaseManager.php:136
сама функция тут https://github.com/yiisoft/yii2/blob/master/framework/rbac/BaseManager.php#L129
вывел var_dump($permission); - - у меня показывает NULL
p.s. - вначале вопрос был по этому модулю, но в процессе я его решил, но заметил другую ошибку. Так что извините, что не там написал issue
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.