当前位置: 首页>>代码示例>>PHP>>正文


PHP Sentry::findAllUsersInGroup方法代码示例

本文整理汇总了PHP中Sentry::findAllUsersInGroup方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentry::findAllUsersInGroup方法的具体用法?PHP Sentry::findAllUsersInGroup怎么用?PHP Sentry::findAllUsersInGroup使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Sentry的用法示例。


在下文中一共展示了Sentry::findAllUsersInGroup方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: edit

 /**
  * Show the form for editing the specified resource.
  *
  * @param  int  $id
  * @return Response
  */
 public function edit($id)
 {
     $data = $this->project->find($id);
     $group = Sentry::findGroupByName('Project Manager');
     $users = Sentry::findAllUsersInGroup($group);
     return View::make('projects.edit')->with('projects', $data)->with('users', $users);
 }
开发者ID:arikazukitomaharjan,项目名称:OfficeSystem,代码行数:13,代码来源:ProjectController.php

示例2: deleteRole

 public function deleteRole($id)
 {
     PermApi::access_check('manage_permissions');
     try {
         DB::beginTransaction();
         // start the DB transaction
         $group = Sentry::findGroupById($id);
         $authenticatedGroup = Sentry::findGroupById(3);
         // super admin group cannot be deleted
         if ($id == 1 || $id == 3) {
             SentryHelper::setMessage('This role cannot be deleted.', 'warning');
             return Redirect::to('user/permission/list');
         }
         // assign authenticated user group
         $users = Sentry::findAllUsersInGroup($group);
         foreach ($users as $user) {
             $user->addGroup($authenticatedGroup);
         }
         // delete group
         $group->delete();
         // clear permission in group mapping
         DB::table('permission_in_group')->where('group_id', $id)->delete();
         DB::table('users_groups')->where('user_id', $id)->update(array('group_id' => $authenticatedGroup->id));
         DB::commit();
         // commit the DB transaction
         SentryHelper::setMessage('Role deleted, all users of this role are now Authenticated users.');
         return Redirect::to('user/permission/list');
     } catch (\Exception $e) {
         DB::rollback();
         // something went wrong
     }
 }
开发者ID:l4mod,项目名称:sentryuser,代码行数:32,代码来源:SentryPermission.php

示例3: checkForOtherAdmins

 public function checkForOtherAdmins($data)
 {
     try {
         $userId = $data['userid'];
         $group = \Sentry::findGroupByName('admin');
         $users = \Sentry::findAllUsersInGroup($group)->toArray();
         if (sizeof($users) == 0) {
             throw new \Exception('this cant be right');
         }
         if (sizeof($users) == 1) {
             if ($users[0]['id'] == $userId) {
                 return false;
             }
         }
         return true;
     } catch (\Exception $e) {
         \Log::error('Something Went Wrong in User Repository - checkForOtherAdmins():' . $e->getMessage());
     }
 }
开发者ID:ymnl007,项目名称:92five,代码行数:19,代码来源:UserRepository.php


注:本文中的Sentry::findAllUsersInGroup方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。