我希望我的扩展程序注意到你有权限,在记录 Bolt 谈论 $ app ['user'] -> isAllowed() 时,是否有任何使用它的示例?
问问题
254 次
1 回答
1
方法isAllowed()的用法可能因用途而异。
一种可能的扩展名是可编辑的:http: //bit.ly/1teHdS9
更详细的描述可以在 Doccode 中找到:
/**
* Runs a permission check. Permissions are encoded as strings, where
* the ':' character acts as a separator for dynamic parts and
* sub-permissions.
* Apart from the route-based rules defined in permissions.yml, the
* following special cases are available:
*
* "overview:$contenttype" - view the overview for the content type. Alias
* for "contenttype:$contenttype:view".
* "contenttype:$contenttype",
* "contenttype:$contenttype:view",
* "contenttype:$contenttype:view:$id" - View any item or a particular item
* of the specified content type.
* "contenttype:$contenttype:edit",
* "contenttype:$contenttype:edit:$id" - Edit any item or a particular item
* of the specified content type.
* "contenttype:$contenttype:create" - Create a new item of the specified
* content type. (It doesn't make sense
* to provide this permission on a
* per-item basis, for obvious reasons)
* "contenttype:$contenttype:change-ownership",
* "contenttype:$contenttype:change-ownership:$id" - Change the ownership
* of the specified content type or item.
*
* @param string $what The desired permission, as elaborated upon above.
* @return bool TRUE if the permission is granted, FALSE if denied.
*/
由于扩展架构师将在即将发布的 v2 中略有变化,因此 isAllowed()与以前相同。
于 2014-08-28T14:27:54.640 回答