本文整理汇总了PHP中Permissions::instance方法的典型用法代码示例。如果您正苦于以下问题:PHP Permissions::instance方法的具体用法?PHP Permissions::instance怎么用?PHP Permissions::instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Permissions
的用法示例。
在下文中一共展示了Permissions::instance方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getInstance
function getInstance()
{
if (!isset(self::$instance)) {
$c = __CLASS__;
self::$instance = new $c();
}
return self::$instance;
}
示例2: action_edit
public function action_edit($user = null)
{
$id = $this->request->param('id');
try {
$user = $user != null ? $user : Sentry::getUserProvider()->findById($id);
$permissions = is_array($user->permissions) ? array_keys($user->permissions) : array();
//split up the user groups
$groups = $user->not_in_groups(true);
$this->_tpl->content = View::factory('s4k/user/manage/edit', array('user' => $user, 'groups' => $groups, 'permissions' => Permissions::instance()->split($permissions)));
} catch (\Cartalyst\Sentry\Users\UserNotFoundException $e) {
Hint::set(Hint::ERROR, 'No corresponding user found');
$this->redirect(Route::url('S4K.users.manage', null, true));
}
}
示例3: action_edit
public function action_edit($group = null)
{
$id = $this->request->param('id');
try {
$group = $group == null ? Sentry::getGroupProvider()->findById($id) : $group;
//get the permission names of this group
$permissions = is_array($group->permissions) ? array_keys($group->permissions) : array();
$this->_tpl->content = View::factory('s4k/groups/edit', array('group' => $group, 'permissions' => Permissions::instance()->split($permissions)));
} catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
//set an error message an redirect to the management page
Hint::set(Hint::ERROR, 'No corresponding group found');
$this->redirect(Route::url('S4K.groups', null, true));
}
}
示例4: paginate
/**
* This function will return paginated result. Result is an array where first element is
* array of returned object and second populated pagination object that can be used for
* obtaining and rendering pagination data using various helpers.
*
* Items and pagination array vars are indexed with 0 for items and 1 for pagination
* because you can't use associative indexing with list() construct
*
* @access public
* @param array $arguments Query argumens (@see find()) Limit and offset are ignored!
* @param integer $items_per_page Number of items per page
* @param integer $current_page Current page number
* @return array
*/
function paginate($arguments = null, $items_per_page = 10, $current_page = 1)
{
if (isset($this) && instance_of($this, 'Permissions')) {
return parent::paginate($arguments, $items_per_page, $current_page);
} else {
return Permissions::instance()->paginate($arguments, $items_per_page, $current_page);
}
// if
}
示例5: manager
/**
* Return manager instance
*
* @access protected
* @param void
* @return Permissions
*/
function manager()
{
if (!$this->manager instanceof Permissions) {
$this->manager = Permissions::instance();
}
return $this->manager;
}