W
W
wartur2013-01-22 13:42:13
Yii
wartur, 2013-01-22 13:42:13

Yii - is it possible to create such a filter that would prohibit all actions except those allowed?

Hello. Yii-zero.
As you know from the guide, in order to prohibit certain controller actions, you need to define a deny rule in the filter:

return array(<br>
    // … разные правила …<br>
    // это правило полностью запрещает действие 'delete'<br>
    array('deny',<br>
        'actions'=>array('delete'),<br>
    ),<br>
);<br>

This approach is very prone to errors, because you can always forget about the prohibition rule. I really want not to list these actions and ban all at once except for certain ones.
Question: is there any "official means" of such a ban, in my understanding, something like this:
return array(<br>
    // … разные правила …<br>
    // это правило полностью запрещает все действия<br>
    array('deny',<br>
        'actions'=>'*',<br>
    ),<br>
);<br>

If not, are there any out-of-the-box extensions to the filtering system class?
Judging by the framework code, I didn’t seem to find the built-in functionality, but maybe I missed something?
Thank you for your attention.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
W
wartur, 2013-01-22
@wartur

Oh, gentlemen, as always, a conversation with a duck helps =).

 *   // optional, list of action IDs (case insensitive) that this rule applies to
 *   // if not specified, rule applies to all actions
 *   'actions'=>array('edit', 'delete'),

Thanks to all. Good luck. I hope someone helped.

S
samizdam, 2014-04-25
@samizdam

RBAC. I use it in the form of the Rights module, there is a good GUI for the average size of applications.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question