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


PHP Sentry::createGroup方法代码示例

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


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

示例1: postUpdate

 function postUpdate($id = 0, &$data)
 {
     $groupName = trim(Input::get('name'));
     if ($id == 0) {
         try {
             // Create the group
             $group = Sentry::createGroup(array('name' => $groupName));
             $data['id'] = $group->id;
             $data['status'] = TRUE;
         } catch (\Cartalyst\Sentry\Groups\NameRequiredException $e) {
             $data['message'] = "Vui lòng nhập tên nhóm";
         } catch (\Cartalyst\Sentry\Groups\GroupExistsException $e) {
             $data['message'] = "Tên nhóm đã tồn tại. Vui lòng nhập tên nhóm khác";
         }
     } else {
         try {
             // Find the group using the group id
             $group = Sentry::findGroupById($id);
             // Update the group details
             $group->name = $groupName;
             if ($group->save()) {
                 $data['status'] = TRUE;
             }
         } catch (\Cartalyst\Sentry\Groups\NameRequiredException $e) {
             $data['message'] = "Vui lòng nhập tên nhóm";
         } catch (\Cartalyst\Sentry\Groups\GroupExistsException $e) {
             $data['message'] = "Tên nhóm đã tồn tại. Vui lòng nhập tên nhóm khác";
         } catch (\Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
             $data['message'] = "Nhóm không tồn tại";
         }
     }
 }
开发者ID:huycao,项目名称:yoplatform,代码行数:32,代码来源:UserGroupAdminController.php

示例2: run

 public function run()
 {
     //Hapus isi table users, groups, users_groups dan Throttle
     DB::table('users_groups')->delete();
     DB::table('groups')->delete();
     DB::table('users')->delete();
     DB::table('throttle')->delete();
     try {
         //Membuat grup admin
         $group = Sentry::createGroup(array('name' => 'admin', 'permissions' => array('admin' => 1)));
     } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
         echo 'Name field is required';
     } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
         echo 'Group already exists';
     }
     try {
         //Membuat admin baru
         $admin = Sentry::register(array('username' => 'admin', 'password' => 'admin', 'first_name' => 'Admin', 'last_name' => 'Koperasi'), true);
         //Langsung diaktivasi
         //Cari Group Admin
         $adminGroup = Sentry::findGroupByName('admin');
         //Masukkan user ke Group admin
         $admin->addGroup($adminGroup);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         echo 'Login field is required.';
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         echo 'Password field is required.';
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         echo 'User with this login already exists.';
     } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
         echo 'Group was not found.';
     }
 }
开发者ID:albertxiao,项目名称:Koperasi,代码行数:33,代码来源:UserTableSeeder.php

示例3: run

 public function run()
 {
     DB::table('users_groups')->delete();
     DB::table('groups')->delete();
     DB::table('users')->delete();
     DB::table('throttle')->delete();
     try {
         //membuat group admin
         $group = Sentry::createGroup(array('name' => 'admin', 'permissions' => array('admin' => 1)));
         //membuat group guru
         $guru = Sentry::createGroup(array('name' => 'guru', 'permissions' => array('guru' => 1)));
         //membuat group siswa
         $siswa = Sentry::createGroup(array('name' => 'siswa', 'permissions' => array('siswa' => 1)));
     } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
         echo "Nama Group harus diisi";
     } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
         echo "Group Sudah Ada";
     }
     try {
         //membuat admin baru
         $admin = Sentry::register(array('password' => 'admin123', 'username' => 'Admin'), true);
         //cari group admin
         $adminGroup = Sentry::findGroupByName('admin');
         //masukan user ke group admin
         $admin->addGroup($adminGroup);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         echo "Field login harus diisi";
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         echo "Password harus diisi";
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         echo "User dengan akun ini sudah ada";
     } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
         echo "Group tidak ada";
     }
 }
开发者ID:jamalapriadi,项目名称:sia,代码行数:35,代码来源:SentrySeeder.php

示例4: run

 public function run()
 {
     DB::table('users_groups')->delete();
     DB::table('groups')->delete();
     DB::table('users')->delete();
     DB::table('throttle')->delete();
     try {
         $group = Sentry::createGroup(array('name' => 'administrator', 'description' => 'Administrator', 'permissions' => array('admin' => 1)));
         $group = Sentry::createGroup(array('name' => 'operator', 'description' => 'Operator', 'permissions' => array('operator' => 1)));
     } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
         echo "Name file is Required";
     } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
         echo "Group already exists";
     }
     try {
         $admin = Sentry::register(array('email' => 'admin@mail.com', 'password' => 'admin', 'first_name' => 'Administrator', 'last_name' => 'IT KSA'), true);
         $adminGroup = Sentry::findGroupByName('administrator');
         $admin->addGroup($adminGroup);
         $operator = Sentry::register(array('email' => 'antoniosaiful10@gmail.com', 'password' => '090996o9o9g6!@#', 'first_name' => 'Operator', 'last_name' => 'IT KSA'), true);
         $operatorGroup = Sentry::findGroupByName('operator');
         $operator->addGroup($operatorGroup);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         echo "Login field is required";
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         echo "Password field is required";
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         echo "User with this login is Required";
     } catch (Cartalyst\Sentry\Users\GroupNotFoundException $e) {
         echo "Group was not found";
     }
 }
开发者ID:antoniosai,项目名称:daily-activity-management,代码行数:31,代码来源:SentrySeeder.php

示例5: run

 public function run()
 {
     DB::table('groups')->truncate();
     $admin = Sentry::createGroup(array('name' => 'Manager', 'permissions' => []));
     $staff = Sentry::createGroup(array('name' => 'Store Manager', 'permissions' => []));
     $staff = Sentry::createGroup(array('name' => 'Sales Person', 'permissions' => []));
     \Mualnuam\Permission::revoke();
 }
开发者ID:nurulimamnotes,项目名称:point-of-sale,代码行数:8,代码来源:GroupTableSeeder.php

示例6: createGroup

 /**
  * Create roles if they don't exist already
  *
  */
 protected function createGroup($name)
 {
     try {
         $group = \Sentry::createGroup(['name' => $name, 'permissions' => ['superuser' => 1]]);
     } catch (\Exception $e) {
         // this group probably already exists... so ignore the exception
     }
 }
开发者ID:codesleeve,项目名称:platform-core,代码行数:12,代码来源:Platform.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     // ID 1
     $admin = \Sentry::register(['email' => env('ADMIN_EMAIL'), 'password' => env('ADMIN_PASSWORD'), 'timezone' => env('ADMIN_TIMEZONE')], true);
     // ID 1
     $adminGroup = \Sentry::createGroup(array('name' => 'Superuser', 'permissions' => array('superuser' => 1)));
     $admin->addGroup($adminGroup);
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:13,代码来源:AdminSeeder.php

示例8: run

 public function run()
 {
     Sentry::createGroup(array('name' => 'Carga Inicial'));
     Sentry::createGroup(array('name' => 'Trabajador Social'));
     Sentry::createGroup(array('name' => 'Autorizador'));
     Sentry::createGroup(array('name' => 'Administrador'));
     //, 'permissions' => '{"superuser":1}'
 }
开发者ID:armandolazarte,项目名称:sasyc,代码行数:8,代码来源:GruposTableSeeder.php

示例9: run

 public function run()
 {
     DB::table('groups')->delete();
     Sentry::createGroup(array('name' => 'administrador', 'permissions' => array('admin' => 1, 'deeds_index' => 1, 'deeds_create' => 1, 'deeds_update' => 1, 'deeds_delete' => 1, 'agrarians_index' => 1, 'agrarians_create' => 1, 'agrarians_update' => 1, 'agrarians_delete' => 1, 'civils_index' => 1, 'civils_create' => 1, 'civils_update' => 1, 'civils_delete' => 1, 'penals_index' => 1, 'penals_create' => 1, 'penals_update' => 1, 'penals_delete' => 1, 'records_index' => 1, 'records_create' => 1, 'records_update' => 1, 'records_delete' => 1, 'notaries_index' => 1, 'notaries_create' => 1, 'notaries_update' => 1, 'notaries_delete' => 1, 'municipalities_index' => 1, 'municipalities_create' => 1, 'municipalities_update' => 1, 'municipalities_delete' => 1, 'users_index' => 1, 'users_create' => 1, 'users_update' => 1, 'users_delete' => 1, 'groups_index' => 1, 'groups_create' => 1, 'groups_update' => 1, 'groups_delete' => 1, 'profiles_index' => 1, 'profiles_create' => 1, 'profiles_update' => 1, 'profiles_delete' => 1, 'comments_index' => 1, 'comments_create' => 1, 'comments_update' => 1, 'comments_delete' => 1)));
     Sentry::createGroup(array('name' => 'director', 'permissions' => array('admin' => 1, 'deeds_index' => 1, 'deeds_create' => 1, 'deeds_update' => 1, 'deeds_delete' => 1, 'agrarians_index' => 1, 'agrarians_create' => 1, 'agrarians_update' => 1, 'agrarians_delete' => 1, 'civils_index' => 1, 'civils_create' => 1, 'civils_update' => 1, 'civils_delete' => 1, 'penals_index' => 1, 'penals_create' => 1, 'penals_update' => 1, 'penals_delete' => 1, 'records_index' => 1, 'records_create' => 1, 'records_update' => 1, 'records_delete' => 1, 'notaries_index' => 1, 'notaries_create' => 1, 'notaries_update' => 1, 'notaries_delete' => 1, 'municipalities_index' => 1, 'municipalities_create' => 1, 'municipalities_update' => 1, 'municipalities_delete' => 1, 'users_index' => 1, 'users_create' => 1, 'users_update' => 1, 'users_delete' => 1, 'groups_index' => 1, 'groups_create' => 1, 'groups_update' => 1, 'groups_delete' => 1, 'profiles_index' => 1, 'profiles_create' => 1, 'profiles_update' => 1, 'profiles_delete' => 1, 'comments_index' => 1, 'comments_create' => 1, 'comments_update' => 1, 'comments_delete' => 1)));
     Sentry::createGroup(array('name' => 'secretaria', 'permissions' => array('admin' => 1, 'deeds_index' => 1, 'deeds_create' => 1, 'deeds_update' => 1, 'deeds_delete' => 1, 'agrarians_index' => 1, 'agrarians_create' => 1, 'agrarians_update' => 1, 'agrarians_delete' => 1, 'civils_index' => 1, 'civils_create' => 1, 'civils_update' => 1, 'civils_delete' => 1, 'penals_index' => 1, 'penals_create' => 1, 'penals_update' => 1, 'penals_delete' => 1, 'records_index' => 1, 'records_create' => 1, 'records_update' => 1, 'records_delete' => 1, 'notaries_index' => 1, 'notaries_create' => 1, 'notaries_update' => 1, 'notaries_delete' => 1, 'municipalities_index' => 1, 'municipalities_create' => 1, 'municipalities_update' => 1, 'municipalities_delete' => 1, 'users_index' => 1, 'users_create' => 1, 'users_update' => 1, 'users_delete' => 1, 'groups_index' => 1, 'groups_create' => 1, 'groups_update' => 1, 'groups_delete' => 1, 'profiles_update' => 1, 'comments_index' => 1, 'comments_create' => 1, 'comments_update' => 1, 'comments_delete' => 1)));
     Sentry::createGroup(array('name' => 'practicante', 'permissions' => array('admin' => 1, 'deeds_index' => 1, 'deeds_create' => 1, 'deeds_update' => 1, 'deeds_delete' => 1, 'agrarians_index' => 1, 'agrarians_create' => 1, 'agrarians_update' => 1, 'agrarians_delete' => 1, 'civils_index' => 1, 'civils_create' => 1, 'civils_update' => 1, 'civils_delete' => 1, 'penals_index' => 1, 'penals_create' => 1, 'penals_update' => 1, 'penals_delete' => 1, 'records_index' => 1, 'records_create' => 1, 'records_update' => 1, 'records_delete' => 1, 'notaries_index' => 1, 'notaries_create' => 1, 'notaries_update' => 1, 'notaries_delete' => 1, 'municipalities_index' => 1, 'municipalities_create' => 1, 'municipalities_update' => 1, 'municipalities_delete' => 1, 'profiles_update' => 1, 'comments_index' => 1, 'comments_create' => 1, 'comments_update' => 1, 'comments_delete' => 1)));
     Sentry::createGroup(array('name' => 'usuario', 'permissions' => array('users' => 1, 'deeds_index' => 1, 'agrarians_index' => 1, 'civils_index' => 1, 'penals_index' => 1, 'records_index' => 1, 'notaries_index' => 1, 'municipalities_index' => 1, 'profiles_update' => 1, 'comments_index' => 1, 'comments_create' => 1, 'comments_update' => 1, 'comments_delete' => 1)));
 }
开发者ID:hectorz11,项目名称:laravel_sistema_art,代码行数:9,代码来源:GroupTableSeeder.php

示例10: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     //创建用户组
     Sentry::createGroup(array('name' => 'Admin', 'is_admin' => 1, 'permissions' => []));
     Sentry::createGroup(array('name' => 'Guest', 'is_admin' => 0, 'permissions' => []));
     $user = Sentry::createUser(array('email' => 'admin@admin.com', 'username' => 'admin', 'password' => '123456', 'activated' => true));
     $adminGroup = Sentry::findGroupById(1);
     $user->addGroup($adminGroup);
     Uinfo::create(['uid' => $user->id]);
 }
开发者ID:leebivip,项目名称:laravel_cmp,代码行数:15,代码来源:SentryInitSeeder.php

示例11: run

 public function run()
 {
     DB::table('users')->delete();
     DB::table('groups')->delete();
     DB::table('users_groups')->delete();
     $user = Sentry::createUser(array('username' => 'superadmin', 'password' => 'ad123min', 'first_name' => 'Super', 'last_name' => 'Administrator', 'activated' => 1));
     $group = Sentry::createGroup(array('name' => 'Super Administrators', 'permissions' => array('superuser' => 1)));
     // Assign user permissions
     $userGroup = Sentry::findGroupById(1);
     $user->addGroup($userGroup);
 }
开发者ID:ratno,项目名称:Doptor,代码行数:11,代码来源:SentrySeeder.php

示例12: createSuperuser

 /**
  * Create new random superuser.
  *
  * @param string $password
  *
  * @return \VisualAppeal\Connect\User
  */
 protected function createSuperuser($password = '123456')
 {
     $lastLogin = $this->faker->dateTime();
     $admin = \Sentry::createUser(['email' => $this->faker->email, 'password' => $password, 'activated' => 1, 'activated_at' => $this->faker->dateTime($lastLogin), 'last_login' => $lastLogin, 'first_name' => $this->faker->firstName, 'last_name' => $this->faker->lastName]);
     try {
         $adminGroup = Sentry::findGroupById(1);
     } catch (Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
         $adminGroup = Sentry::createGroup(['name' => 'Superuser', 'permissions' => ['superuser' => 1]]);
     }
     $admin->addGroup($adminGroup);
     return $admin;
 }
开发者ID:rafaelvieiras,项目名称:connect,代码行数:19,代码来源:TestCase.php

示例13: run

 public function run()
 {
     // 清空数据
     DB::table('users')->truncate();
     DB::table('groups')->truncate();
     DB::table('users_groups')->truncate();
     //创建用户组
     $group = Sentry::createGroup(array('name' => '管理员', 'permissions' => array('superuser' => '1')));
     // 创建用户
     $user = Sentry::createUser(array('email' => 'admin', 'password' => "123456", 'first_name' => 'admin', 'last_name' => '', 'activated' => 1));
     //关联用户组
     $user->addGroup($group);
 }
开发者ID:xiaohulidudu,项目名称:laravel-blog,代码行数:13,代码来源:SentrySeeder.php

示例14: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     //
     try {
         // Create the group
         $group = Sentry::createGroup(array('name' => Input::get('name'), 'permissions' => is_array(Input::get('permissions')) ? array_fill_keys(Input::get('permissions'), 1) : array()));
         return Redirect::route('admin.groups.index');
     } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
         return Redirect::back()->withInput()->withErrors('Name field is required');
     } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
         return Redirect::back()->withInput()->withErrors('Group already exists');
     }
 }
开发者ID:kettanyam,项目名称:20141001done,代码行数:18,代码来源:GroupsController.php

示例15: run

 public function run()
 {
     DB::table('users')->delete();
     DB::table('groups')->delete();
     DB::table('users_groups')->delete();
     Sentry::getUserProvider()->create(array('email' => 'admin@admin.com', 'password' => "admin", 'first_name' => 'Transport', 'last_name' => 'Social', 'activated' => 1));
     Sentry::getGroupProvider()->create(array('name' => 'Admin', 'permissions' => array('admin' => 1)));
     Sentry::createGroup(array('name' => 'Users', 'permissions' => array('admin' => 0, 'users' => 1)));
     // Assign user permissions
     $adminUser = Sentry::getUserProvider()->findByLogin('admin@admin.com');
     $adminGroup = Sentry::getGroupProvider()->findByName('Admin');
     $adminUser->addGroup($adminGroup);
 }
开发者ID:justinf111,项目名称:laravel-blog,代码行数:13,代码来源:SentrySeeder.php


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