本文整理汇总了PHP中Sentry::findAllGroups方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentry::findAllGroups方法的具体用法?PHP Sentry::findAllGroups怎么用?PHP Sentry::findAllGroups使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentry
的用法示例。
在下文中一共展示了Sentry::findAllGroups方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: setupLayout
/**
* Setup the layout used by the controller.
*
* @return void
*/
protected function setupLayout()
{
View::share("h4ss2_groups", Sentry::findAllGroups());
if (!is_null($this->layout)) {
$this->layout = View::make($this->layout);
}
}
示例2: all_groups
public static function all_groups()
{
$groups = array();
foreach (Sentry::findAllGroups() as $group) {
$groups[$group->id] = $group->name;
}
return $groups;
}
示例3: index
/**
* Display a listing of groups
*
* @return Response
*/
public function index()
{
if (!Sentry::getUser()) {
return Redirect::route('sessions.create');
}
$groups = Sentry::findAllGroups();
return View::make('groups.index', compact('groups'));
}
示例4: getGroupsArray
public static function getGroupsArray()
{
$groups = Sentry::findAllGroups();
$arrGroups = array();
foreach ($groups as $group) {
$arrGroups[$group->id] = $group->name;
}
return $arrGroups;
}
示例5: getModificar
public function getModificar($id = null)
{
if ($id == null) {
$data['grupo'] = new \Grupo();
$permisosGlobales = \Grupo::$permisos;
try {
$sentryGroup = \Sentry::findAllGroups();
} catch (Exception $ex) {
$sentryGroup = null;
}
if (is_object($sentryGroup)) {
$data['permisos'] = array();
foreach ($permisosGlobales as $key => $permiso) {
$data['permisos'][$key] = array('Descripcion' => array_values($permiso)[0]);
$tiene = false;
foreach ($permiso as $per => $descripcion) {
if ($sentryGroup->hasAccess($per)) {
$data['permisos'][$key][$per] = $descripcion;
$tiene = true;
}
}
if (!$tiene) {
unset($data['permisos'][$key]);
}
}
} else {
$data['permisos'] = array('' => array());
}
return \View::make('administracion.seguridad.creargrupos', $data);
}
$data['grupo'] = \Grupo::find($id);
$permisosGlobales = \Grupo::$permisos;
try {
$sentryGroup = \Sentry::findGroupById($id);
} catch (Exception $ex) {
$sentryGroup = null;
}
if (is_object($sentryGroup)) {
$data['permisos'] = array();
foreach ($permisosGlobales as $key => $permiso) {
$data['permisos'][$key] = array('Descripcion' => array_values($permiso)[0]);
$tiene = false;
foreach ($permiso as $per => $descripcion) {
if ($sentryGroup->hasAccess($per)) {
$data['permisos'][$key][$per] = $descripcion;
$tiene = true;
}
}
if (!$tiene) {
unset($data['permisos'][$key]);
}
}
} else {
$data['permisos'] = array('' => array());
}
return \View::make('administracion.seguridad.gruposform', $data);
}
示例6: getAdminIndex
/**
* admin.groups.index
*
*/
public function getAdminIndex()
{
if (Sentry::hasAnyAccess(['groups_index'])) {
$groups = Sentry::findAllGroups();
return View::make('groups.admin.index', ['groups' => $groups]);
} else {
return Redirect::route('pages.error');
}
}
示例7: export
public function export($identifier = null)
{
// Request all the group
$sentry_data = \Sentry::findAllGroups();
// Push them in an array
$groups = array();
foreach ($sentry_data as $g) {
array_push($groups, $g->toArray());
}
return $groups;
}
示例8: edit
/**
* Show the form for editing the specified resource.
*
* @param int $id
* @return Response
*/
public function edit($id)
{
$user = $this->user->find($id);
$groups = Sentry::findAllGroups();
$user_group = $user->getGroups()->first()->id;
$array_groups = [];
foreach ($groups as $group) {
$array_groups = array_add($array_groups, $group->id, $group->name);
}
return View::make('protected.admin.edit_user', ['user' => $user, 'groups' => $array_groups, 'user_group' => $user_group]);
}
示例9: getIndex
/**
* Admin.user.view
*/
public function getIndex()
{
// Set permission
Auth::requirePermissions('admin.user.view');
// Get all users
$users = \Sentry::findAllUsers();
// Get all groups
$groups = \Sentry::findAllGroups();
// Get error
$error = Flash::get();
$view = \View::make('ui.users.list')->with('title', 'User management | The Datatank')->with('users', $users)->with('groups', $groups)->with('error', $error);
return \Response::make($view);
}
示例10: PUT_updateUser
public function PUT_updateUser($id)
{
$theme = Theme::uses('notebook')->layout('main');
$theme->setMenu('user.user');
try {
$user = Sentry::findUserById($id);
$user->email = Input::get('email');
$user->first_name = Input::get('full_name');
if (Input::has('password')) {
$user->password = Input::get('password');
}
$all_groups = Sentry::findAllGroups();
if (is_array($all_groups)) {
foreach ($all_groups as $key => $all_group) {
$findGroup = Sentry::findGroupById($all_group->id);
$user->removeGroup($findGroup);
}
}
$groups = Input::get('groups');
if (is_array($groups)) {
foreach ($groups as $key => $group) {
$adminGroup = Sentry::findGroupById($group);
$user->addGroup($adminGroup);
}
}
if ($user->save()) {
$success = 'User information was updated';
} else {
$failed = 'User information was not updated';
}
} catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
$failed = 'Login field is required.';
} catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
$failed = 'Password field is required.';
} catch (Cartalyst\Sentry\Users\UserExistsException $e) {
$failed = 'User with this login already exists.';
} catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
$failed = 'Group was not found.';
}
if (!empty($failed)) {
return Redirect::to(route('user.list'))->with('STATUS_FAIL', $failed);
} else {
if (!empty($success)) {
return Redirect::to(route('user.list'))->with('STATUS_OK', $success);
}
}
}
示例11: getIndex
/**
* Admin.group.view
*/
public function getIndex()
{
// Set permission
Auth::requirePermissions('admin.group.view');
// Get all users
$users = \Sentry::findAllUsers();
// Get all groups
$groups = \Sentry::findAllGroups();
// Get all permissions
$permission_groups = \Config::get('permissions');
$input_permission_groups = \Config::get('tdt/input::permissions');
if (!empty($input_permission_groups)) {
$permission_groups = array_merge($permission_groups, $input_permission_groups);
}
// Get error
$error = Flash::get();
return \View::make('ui.groups.list')->with('title', 'Group management | The Datatank')->with('users', $users)->with('groups', $groups)->with('permission_groups', $permission_groups)->with('error', $error);
return \Response::make($view);
}
示例12: GET_assignGroupForm
public function GET_assignGroupForm()
{
$theme = Theme::uses('notebook')->layout('main');
$theme->asset()->container('post-scripts')->usePath()->add('laravel', 'js/laravel.js');
$theme->setMenu('user.group');
$routes = Route::getRoutes();
$groups = Sentry::findAllGroups();
$permits = array();
if (is_array($groups)) {
foreach ($groups as $group) {
$findGroup = Sentry::findGroupById($group->id);
$permissions = $findGroup->getPermissions();
$permits[$group->name] = array();
foreach ($permissions as $key => $permission) {
$permits[$group->name][] = $key;
}
}
}
$params = array('routes' => $routes, 'groups' => $groups, 'permits' => $permits);
return $theme->scope('user.group-assign', $params)->render();
}
示例13: index
/**
* Display a listing of the resource.
*
* @return Response
*/
public function index()
{
//
return View::make('admin.groups.index')->with('groups', Sentry::findAllGroups());
}
示例14:
<div class="icon-object border-success text-success"><i class="icon-plus3"></i></div>
<h5 class="content-group-lg">Nuevo Usuario <small class="display-block">Todos los campos son obligatorios</small></h5>
</div>
<div class="form-group has-feedback">
<?php
$readonly = !empty($user) ? 'readonly' : '';
?>
<input type="text" name="username" class="form-control" placeholder="Usuario" required value="{{ $user->username or '' }}" {{ $readonly }}>
<div class="form-control-feedback">
<i class="icon-user-plus text-muted"></i>
</div>
</div>
<div class="form-group has-feedback">
<select class="form-control" name="group" id="group" required>
<?php
$groups = Sentry::findAllGroups();
?>
<?php
$userGroup = !empty($user) ? $user->getGroups() : 0;
?>
<option value="">Seleccionar Perfil</option>
@foreach ( $groups as $item )
<?php
$selected = '';
?>
@if ( $userGroup )
<?php
$selected = $userGroup['0']['id'] == $item->id ? 'selected' : '';
?>
@endif
<option value="{{ $item->id }}" {{ $selected }}>{{ $item->name }}</option>
示例15: function
});
Route::get('/login', 'AuthController@getLogin');
Route::get('/logout', 'AuthController@getLogout');
Route::post('/login', 'AuthController@postLogin');
Route::get('/password', 'AuthController@getForgot');
Route::post('/password', 'AuthController@postForgot');
Route::controller('/password', 'AuthController');
Route::controller('/', 'HomeController');
/*
|--------------------------------------------------------------------------
| View Composers
|--------------------------------------------------------------------------
*/
// View composer for all admin views
View::composer('admin.*', function ($view) {
$adminUser = false;
if (Sentry::check()) {
$user = Sentry::getUser();
if ($user->hasAccess('admin')) {
$adminUser = $user;
}
}
$view->with('adminUser', $adminUser);
});
View::composer(array('admin.layouts.default', 'layouts.bootstrap'), function ($view) {
$rjs_config = File::exists(public_path() . '/assets/scripts/config.js') ? File::get(public_path() . '/assets/scripts/config.js') : '';
$view->with('rjs_config', $rjs_config);
});
View::composer('admin.user.form', function ($view) {
$view->with('groups', Sentry::findAllGroups());
});