本文整理汇总了PHP中Sentry::getGroupProvider方法的典型用法代码示例。如果您正苦于以下问题:PHP Sentry::getGroupProvider方法的具体用法?PHP Sentry::getGroupProvider怎么用?PHP Sentry::getGroupProvider使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Sentry
的用法示例。
在下文中一共展示了Sentry::getGroupProvider方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getAdminUser
protected function getAdminUser($attr = array())
{
$user = $this->factory->create('User', $attr);
$adminGroup = Sentry::getGroupProvider()->create(array('name' => 'admin', 'permissions' => array('admin' => 1, 'users' => 1)));
$user->addGroup($adminGroup);
return $user;
}
示例2: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(array('name' => 'Users'));
Sentry::getGroupProvider()->create(array('name' => 'Admins'));
Sentry::getGroupProvider()->create(array('name' => 'Subscribers'));
}
示例3: 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' => 'admin', 'last_name' => 'admin', 'activated' => 1));
Sentry::getGroupProvider()->create(array('name' => 'Super Admin', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Office Admin', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Project Manager', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Team Leader', 'permissions' => array('admin' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Developer', 'permissions' => array('admin' => 1)));
Sentry::getUserProvider()->create(array('email' => 'ashok@admin.com', 'password' => "admin", 'first_name' => 'Ashok', 'last_name' => 'Adhikari', 'activated' => 1));
Sentry::getUserProvider()->create(array('email' => 'santosh@admin.com', 'password' => "santosh", 'first_name' => 'Santosh', 'last_name' => 'Dhungana', 'activated' => 1));
Sentry::getUserProvider()->create(array('email' => 'dinesh@admin.com', 'password' => "dinesh", 'first_name' => 'Dinesh', 'last_name' => 'Sharma', 'activated' => 1));
Sentry::getUserProvider()->create(array('email' => 'asheem@admin.com', 'password' => "asheem", 'first_name' => 'Asheem', 'last_name' => 'Manandhar', 'activated' => 1));
// Assign user permissions
$adminUser = Sentry::getUserProvider()->findByLogin('admin@admin.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Super Admin');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('ashok@admin.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Office Admin');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('santosh@admin.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Project Manager');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('dinesh@admin.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Team Leader');
$adminUser->addGroup($adminGroup);
$adminUser = Sentry::getUserProvider()->findByLogin('asheem@admin.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Developer');
$adminUser->addGroup($adminGroup);
}
示例4: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
$this->command->info('Seeding: CustomSentryGroupSeeder Class...');
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(array('name' => 'Users', 'permissions' => array('admin' => 0, 'users' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Admins', 'permissions' => array('admin' => 1, 'users' => 1)));
}
示例5: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$admins = Sentry::getGroupProvider()->findByName('Admins');
$diff = array_diff($this->permissions, $admins->permissions);
$admins->permissions = $diff;
$admins->save();
}
示例6: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('users_groups')->truncate();
$userUser1 = Sentry::getUserProvider()->findByLogin('patient1@skywebplus.com');
$userUser2 = Sentry::getUserProvider()->findByLogin('patient2@skywebplus.com');
$userUser3 = Sentry::getUserProvider()->findByLogin('patient3@skywebplus.com');
$userUser4 = Sentry::getUserProvider()->findByLogin('patient4@skywebplus.com');
$userUser5 = Sentry::getUserProvider()->findByLogin('patient5@skywebplus.com');
$clinic1User = Sentry::getUserProvider()->findByLogin('clinic1@skywebplus.com');
$clinic2User = Sentry::getUserProvider()->findByLogin('clinic2@skywebplus.com');
$doctor1User = Sentry::getUserProvider()->findByLogin('doctor1@skywebplus.com');
$doctor2User = Sentry::getUserProvider()->findByLogin('doctor2@skywebplus.com');
$doctor3User = Sentry::getUserProvider()->findByLogin('doctor3@skywebplus.com');
$adminUser = Sentry::getUserProvider()->findByLogin('admin@skywebplus.com');
$userGroup = Sentry::getGroupProvider()->findByName('Patients');
$doctorsyGroup = Sentry::getGroupProvider()->findByName('Doctors');
$clinicGroup = Sentry::getGroupProvider()->findByName('Clinics');
$adminGroup = Sentry::getGroupProvider()->findByName('Admins');
// Assign the groups to the users
$userUser1->addGroup($userGroup);
$userUser2->addGroup($userGroup);
$userUser3->addGroup($userGroup);
$userUser4->addGroup($userGroup);
$userUser5->addGroup($userGroup);
$clinic1User->addGroup($clinicGroup);
$clinic2User->addGroup($clinicGroup);
$doctor1User->addGroup($doctorsyGroup);
$doctor2User->addGroup($doctorsyGroup);
$doctor3User->addGroup($doctorsyGroup);
$adminUser->addGroup($adminGroup);
}
示例7: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(array('name' => 'Users', 'permissions' => array('admin.users' => 0, 'user.interface' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'Admins', 'permissions' => array('admin.users' => 1, 'user.interface' => 1)));
Sentry::getGroupProvider()->create(array('name' => 'EmfUsers', 'permissions' => array('admin.users' => 0, 'user.interface' => 1, 'emf.login' => 1)));
}
示例8: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(['name' => 'Invitados']);
Sentry::getGroupProvider()->create(['name' => 'Administradores', 'permissions' => ['superuser' => 1]]);
$this->command->info('Groups seeded!');
}
示例9: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->delete();
Sentry::getGroupProvider()->create(['name' => 'Users']);
Sentry::getGroupProvider()->create(['name' => 'Admins']);
$this->command->info('Groups seeded!');
}
示例10: store
/**
* Store a newly created resource in storage.
*
* @return Response
*/
public function store()
{
try {
$rules = array('first_name' => 'required', 'last_name' => 'required', 'email' => 'required|email|unique:users', 'phone' => 'numeric|digits_between:9,20');
$validation = Validator::make(Input::all(), $rules);
if ($validation->fails()) {
return Redirect::back()->withInput()->withErrors($validation->messages());
}
$user = new User();
$user->first_name = Input::get('first_name');
$user->last_name = Input::get('last_name');
$user->email = Input::get('email');
$user->phone = Input::get('phone');
$user->password = '12345';
$user->activated = 1;
if ($user->save()) {
$group = \Sentry::getGroupProvider()->findByName('Admin');
$user->addGroup($group);
return Redirect::back()->with('message', 'Az adminisztrátor felvétele sikerült!');
} else {
return Redirect::back()->withInput()->withErrors('Az adminisztrátor felvétele nem sikerült!');
}
} catch (Exception $e) {
if (Config::get('app.debug')) {
return Redirect::back()->withInput()->withErrors($e->getMessage());
} else {
return Redirect::back()->withInput()->withErrors('Az adminisztrátor felvétele nem sikerült!');
}
}
}
示例11: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
$this->info('Seeding table');
DB::connection()->disableQueryLog();
Eloquent::unguard();
// Configuring curl options
$options = array(CURLOPT_RETURNTRANSFER => true, CURLOPT_HTTPHEADER => array('Content-type: application/json'));
$start = $this->argument('start');
$userGroup = Sentry::getGroupProvider()->findByName('user');
for ($i = $start; $i < $start + 1000; $i++) {
// jSON URL which should be requested
$json_url = 'http://graph.facebook.com/' . $i;
$this->info('Querying ' . $json_url);
// Initializing curl
$ch = curl_init($json_url);
// Setting curl options
curl_setopt_array($ch, $options);
// Getting results
$result = curl_exec($ch);
// Getting jSON result string
$json = json_decode($result);
if (is_object($json) && !property_exists($json, 'error')) {
$this->info('Creating ' . $json->first_name . ' ' . $json->last_name);
$user = Sentry::register(array('first_name' => $json->first_name, 'last_name' => $json->last_name, 'email' => strtolower($json->first_name . '_' . $json->last_name) . '_' . $i . '@facebook.com', 'password' => 'password'), true);
$user->addGroup($userGroup);
Facebook::create(array('user_id' => $user->id, 'oauth_uid' => $i));
} else {
$this->error($json->error->message);
}
}
}
示例12: fire
/**
* Execute the console command.
*
* @return void
*/
public function fire()
{
try {
$email = $this->argument('email');
$pass = $this->argument('password');
$username = $this->argument('username');
$groupName = $this->argument('group');
$validator = new UserValidator(array('email' => $email, 'pass' => $pass, 'username' => $username), 'create');
if (!$validator->passes()) {
foreach ($validator->getErrors() as $key => $messages) {
$this->info(ucfirst($key) . ' :');
foreach ($messages as $message) {
$this->error($message);
}
}
} else {
// Create the user
$user = \Sentry::getUserProvider()->create(array('email' => $email, 'password' => $pass, 'username' => $username));
$activationCode = $user->getActivationCode();
$user->attemptActivation($activationCode);
if ($groupName !== NULL) {
$group = \Sentry::getGroupProvider()->findByName($groupName);
$user->addGroup($group);
}
$this->info('User created with success');
}
} catch (\Cartalyst\Sentry\Users\UserExistsException $e) {
$this->error('User already exists !');
} catch (\Cartalyst\Sentry\Groups\GroupNotFoundException $e) {
$this->error('Group ' . $groupName . ' does not exists !');
}
}
示例13: down
/**
* Reverse the migrations.
*
* @return void
*/
public function down()
{
$groups = array('Users', 'Resellers', 'Admins');
foreach ($groups as $group) {
$sentryGroup = Sentry::getGroupProvider()->findByName($group);
$sentryGroup->delete();
}
}
示例14: run
public function run()
{
DB::table('users_groups')->delete();
$adminUser = Sentry::getUserProvider()->findByLogin('gabormolnar92@gmail.com');
$adminGroup = Sentry::getGroupProvider()->findByName('Admin');
// Assign the groups to the users
$adminUser->addGroup($adminGroup);
}
示例15: run
/**
* Run the database seeds.
*
* @return void
*/
public function run()
{
DB::table('groups')->truncate();
Sentry::getGroupProvider()->create(array('name' => 'Patients'));
Sentry::getGroupProvider()->create(array('name' => 'Doctors'));
Sentry::getGroupProvider()->create(array('name' => 'Clinics'));
Sentry::getGroupProvider()->create(array('name' => 'Admins'));
}