P
P
Pavel Gogolinsky2014-06-23 12:23:45
Yii
Pavel Gogolinsky, 2014-06-23 12:23:45

How to use bizrule in yii rbac?

Rbac is configured according to this recipe
yiiframework.ru/doc/cookbook/en/access.rbac.file
how to use bizrule in auth.php config file and in view?
Let's say a file can only be downloaded by a certain person.
In the view, of course, you can write
if(Yii::app()->user->id == $file->user_id)
But then the administrator will not be able to download this file if he logs in under his account.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
P
Philip, 2014-06-23
@shcherbanich

$role = Yii::app()->authManager->getRoles(Yii::app()->user->id);
check if this is an admin or not, but in general you can write in the rules who has access to the action

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question