AuthComponent:allowedActions和区别允许()? [英] AuthComponent: Difference between allowedActions and allow()?
问题描述
什么是使用AuthComponent :: allowedActions和AuthComponent ::允许之间的区别?
当我谷歌,我看到大部分的使用或谈论允许()的实例和文档,但只有少数使用allowedActions。但他们都似乎使用相似的。
What is the difference between using AuthComponent::allowedActions and AuthComponent::allow? When I Google, I see the majority of examples and documents using or talking about allow(), but only a few using allowedActions. But they both seem similar in usage.
推荐答案
allowedActions是包含允许的操作列表的属性。
allowedActions is a property that contains a list of allowed actions.
允许()是添加动作allowedActions属性的方法。
allow() is a method that adds actions to the allowedActions property.
当你调用允许()方法,它会合并你已经保存在allowedActions动作指定的操作。
When you call the allow() method, it will merge the actions you specify with the actions already kept in allowedActions.
您可以绕过允许()方法,并指定允许的操作直接allowedActions属性的数组,但我只能这样做,如果我绝对必须重写任何行动$ pviously增加(例如对$,由家长类)这个属性。官方文件没有提到allowedActions属性。
You can bypass the allow() method and assign an array of allowed actions to the allowedActions property directly, but I would only do that if I absolutely had to override any actions previously added (for example, by a parent class) to this property. The official documentation makes no reference to the allowedActions property.
这篇关于AuthComponent:allowedActions和区别允许()?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!