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


PHP Sentry::getUserProvider方法代码示例

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


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

示例1: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     Sentry::getUserProvider()->create(['email' => 'administrador@kentron.com.ve', 'password' => '12345678', 'first_name' => 'Administrador', 'last_name' => 'Kentron', 'activated' => 1]);
     Sentry::getUserProvider()->create(['email' => 'invitado@kentron.com.ve', 'password' => '12345678', 'first_name' => 'Invitado', 'last_name' => 'Kentron', 'activated' => 1]);
     $this->command->info('Users seeded!');
 }
开发者ID:kentronvzla,项目名称:webkentron,代码行数:12,代码来源:SentryUserSeeder.php

示例2: 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);
 }
开发者ID:arikazukitomaharjan,项目名称:OfficeSystem,代码行数:32,代码来源:SentrySeeder.php

示例3: 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 !');
     }
 }
开发者ID:vrigzalejo,项目名称:usermanager,代码行数:37,代码来源:UserSeedCommand.php

示例4: 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);
 }
开发者ID:jnicolasbc,项目名称:admin_swp_com,代码行数:36,代码来源:SentryUserGroupSeeder.php

示例5: login

 public function login()
 {
     try {
         $user = Sentry::getUserProvider()->findByLogin(Input::json('email'));
         $throttle = Sentry::getThrottleProvider()->findByUserId($user->id);
         $throttle->setSuspensionTime(10);
         $throttle->setAttemptLimit(3);
         $throttle->check();
         $credentials = ['email' => Input::json('email'), 'password' => Input::json('password')];
         $user = Sentry::authenticate($credentials, false);
     } catch (Cartalyst\Sentry\Users\WrongPasswordException $e) {
         return Response::json(array('flash' => 'Invalid username or password'), 500);
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         return Response::json(array('flash' => 'Login field is required'), 500);
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         return Response::json(array('flash' => 'Password field is required'), 500);
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Response::json(array('flash' => 'Invalid username or password'), 500);
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         return Response::json(array('flash' => 'This account is inactive'), 500);
     } catch (Cartalyst\Sentry\Throttling\UserSuspendedException $e) {
         $time = $throttle->getSuspensionTime();
         return Response::json(array('flash' => 'This account is suspended for ' . $time . ' minutes'), 500);
     } catch (Cartalyst\Sentry\Throttling\UserBannedException $e) {
         return Response::json(array('flash' => 'This account has been banned'), 500);
     }
     $user_details = User::join('users_groups', 'users.id', '=', 'users_groups.user_id')->join('groups', 'users_groups.group_id', '=', 'groups.id')->where('users.id', '=', $user->id)->select('users.id', 'users.email', 'users.first_name', 'users.last_name', 'groups.name as role', 'users.activated_at', 'users.last_login', 'users.created_at', 'users.updated_at')->get();
     return Response::json($user_details[0], 200);
 }
开发者ID:yevta,项目名称:simple-crm-laravel,代码行数:29,代码来源:AuthController.php

示例6: sendForgotPasswordEmail

 /**
  * Sends Forgot Password Email
  * @param string
  * @return bool
  */
 public static function sendForgotPasswordEmail($email)
 {
     try {
         // Find the user using the user email address
         $user = Sentry::getUserProvider()->findByLogin($email);
         // Get the password reset code
         $resetCode = $user->getResetPasswordCode();
         //send this code to your user via email.
         $name = $user->first_name . ' ' . $user->last_name;
         $link = (string) url() . '/auth/recoverpassword?password_reset_token=' . $resetCode . '&email=' . $email;
         $data = array('name' => $name, 'link' => $link);
         Mail::queue('emails.auth.forgotpassword', $data, function ($message) use($user) {
             $message->to($user->email)->subject('Forgot Password Assistance');
         });
         return true;
     } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
         return Redirect::to('login')->with('message', 'error104');
     } catch (Cartalyst\Sentry\Users\UserNotActivatedException $e) {
         return Redirect::to('login')->with('message', 'error103');
     } catch (Cartalyst\Sentry\Users\UserSuspendedException $e) {
         return Redirect::to('login')->with('message', 'error105');
     } catch (Cartalyst\Sentry\Users\UserBannedException $e) {
         return Redirect::to('login')->with('message', 'error102');
     }
 }
开发者ID:ymnl007,项目名称:92five,代码行数:30,代码来源:Email.php

示例7: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users')->delete();
     Sentry::getUserProvider()->create(array('email' => 'user@user.com', 'password' => '123456', 'prenume' => 'UserFirstName', 'nume' => 'UserLastName', 'id_organizatie' => 1, 'activated' => 1));
     Sentry::getUserProvider()->create(array('email' => 'admin@admin.com', 'password' => '123456', 'prenume' => 'AdminFirstName', 'nume' => 'AdminLastName', 'id_organizatie' => 1, 'activated' => 1));
     Sentry::getUserProvider()->create(array('email' => 'admin', 'password' => '123', 'prenume' => 'AdminFirstName', 'nume' => 'AdminLastName', 'id_organizatie' => 1, 'activated' => 1));
 }
开发者ID:binaryk,项目名称:credite,代码行数:12,代码来源:SentryUserSeeder.php

示例8: postAddnewUser

 public function postAddnewUser()
 {
     try {
         $Users = Sentry::getUserProvider()->create(array('email' => Input::get('email'), 'password' => Input::get('password'), 'activated' => 1, 'staff' => 1));
         $staff_id = $Users->id;
     } catch (Cartalyst\Sentry\Users\LoginRequiredException $e) {
         return Redirect::to('dashboard/agencies/view/addnewuser')->with('errors', 'email field is required');
     } catch (Cartalyst\Sentry\Users\PasswordRequiredException $e) {
         return Redirect::to('dashboard/agencies/view/addnewuser')->with('errors', 'Password field is required');
     } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
         return Redirect::to('dashboard/agencies/view/addnewuser')->withInput()->with('errors', 'User with this login already exists');
     }
     $URL = 'Email:' . ' ' . Input::get('email') . '<br/><br/>' . 'Password:' . ' ' . Input::get('password') . '<br/><br/>' . 'Link:' . ' ' . 'http://' . $_SERVER['HTTP_HOST'];
     $this->sendTo(Input::get('email'), array('activationCode' => $URL));
     $fields = array('email' => Input::get('email'), 'password' => Input::get('password'), 'name' => Input::get('name'), 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'fax' => Input::get('fax'), 'address' => Input::get('address'), 'zip' => Input::get('zip'), 'country' => Input::get('country'), 'listing_quota' => Input::get('listing_quota'), 'hot_quota' => Input::get('hot_quota'));
     $rules = array('email' => 'required', 'password' => 'required|min:6', 'name' => 'required', 'cell' => 'required', 'address' => 'required', 'country' => 'required', 'zip' => 'required', 'fax' => 'required', 'listing_quota' => 'required', 'hot_quota' => 'required');
     $v = Validator::make($fields, $rules);
     if ($v->fails()) {
         return Redirect::to('addnewuser')->with('errors', $v);
     }
     $agency_id = Input::get('agency_name');
     $ownerids = AgentUser::where('id', '=', $agency_id)->get();
     foreach ($ownerids as $ownerid) {
         $owner_id = $ownerid->agent_id;
     }
     DB::table('Agencystaff')->insertGetId(array('agency_id' => Input::get('agency_name'), 'staff_id' => $staff_id, 'owner_id' => $owner_id, 'email' => Input::get('email'), 'name' => Input::get('name'), 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'fax' => Input::get('fax'), 'address' => Input::get('address'), 'zip' => Input::get('zip'), 'country' => Input::get('country'), 'listing_quota' => Input::get('listing_quota'), 'hot_quota' => Input::get('hot_quota')));
     DB::table('registration')->insertGetId(array('user_id' => $staff_id, 'name' => Input::get('name'), 'phone' => Input::get('phone'), 'cell' => Input::get('cell'), 'fax' => Input::get('fax'), 'address' => Input::get('address'), 'zip' => Input::get('zip'), 'country' => Input::get('country'), 'photo' => $this->ImageCrop('photo', 'photos', '200', '200', '')));
     $proimg = Input::file('photo');
     return Redirect::to('dashboard/agencies')->with('success', 'successfully Added');
 }
开发者ID:omusico,项目名称:zameenJayedad,代码行数:30,代码来源:AgencyController.php

示例9: admin_post

 public function admin_post()
 {
     $rules = array('email' => 'required|email');
     if (Input::has('password')) {
         $rules['password'] = 'confirmed|required|min:6:max:12';
     }
     $validator = Validator::make(Input::all(), $rules);
     if ($validator->fails()) {
         return Redirect::to('settings')->withErrors($validator)->withInput();
     } else {
         try {
             // Find the user using the user id
             $user = Sentry::getUserProvider()->findById($this->data['admin']->id);
             // Update the user details
             $user->email = Input::get('email');
             $user->first_name = Input::get('password');
             // Update the user
             if ($user->save()) {
                 return Redirect::to('settings')->with('success', 'User information was updated.');
             } else {
                 return Redirect::to('settings')->with('error', 'User information was not updated.');
             }
         } catch (Cartalyst\Sentry\Users\UserExistsException $e) {
             return Redirect::to('settings')->with('error', 'User with this login already exists.');
         } catch (Cartalyst\Sentry\Users\UserNotFoundException $e) {
             return Redirect::to('settings')->with('error', 'User was not found.');
         }
     }
 }
开发者ID:jacobDaeHyung,项目名称:PHPLaravelGymManagementSystem,代码行数:29,代码来源:SettingsController.php

示例10: 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);
 }
开发者ID:gabemiller,项目名称:project-dv,代码行数:8,代码来源:UserGroupTableSeeder.php

示例11: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('tutorials')->delete();
     Eloquent::unguard();
     try {
         // Create the group
         $group = Sentry::getGroupProvider()->create(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 {
         // Create the group
         $group = Sentry::getGroupProvider()->create(array('name' => 'teachers', 'permissions' => array('create_tutorial' => 1, 'update_tutorial' => 1, 'create_exam' => 1, 'update_exam' => 1, 'see_results' => 1, 'see_result' => 1)));
     } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
         echo 'Name field is required';
     } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
         echo 'Group already exists';
     }
     try {
         // Create the group
         $group = Sentry::getGroupProvider()->create(array('name' => 'students', 'permissions' => array('see_tutorial' => 1, 'do_exam' => 1, 'see_result' => 1)));
     } catch (Cartalyst\Sentry\Groups\NameRequiredException $e) {
         echo 'Name field is required';
     } catch (Cartalyst\Sentry\Groups\GroupExistsException $e) {
         echo 'Group already exists';
     }
     try {
         // Create the user
         $user = Sentry::getUserProvider()->create(array('email' => 'johndoe@example.com', 'password' => 'user123456', 'activated' => '1', 'first_name' => 'John', 'last_name' => 'Doe', 'permissions' => array('user.create' => 1, 'user.delete' => 1, 'user.view' => 1, 'user.update' => 1)));
         // Find the group using the group id
         $adminGroup = Sentry::getGroupProvider()->findById(1);
         // Assign the group to the user
         $user->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.';
     }
     $admin = Sentry::getGroupProvider()->findByName('admin');
     $tea = Sentry::getGroupProvider()->findByName('teachers');
     $stu = Sentry::getGroupProvider()->findByName('students');
     $user = Sentry::getUserProvider()->findById(1);
     $user->addGroup($admin);
     $user->addGroup($tea);
     $user->addGroup($stu);
     unset($admin);
     unset($user);
     $this->call('TeacherTableSeeder');
     $this->call('StudentTableSeeder');
     $this->call('SubjectTableSeeder');
 }
开发者ID:eufelipemartins,项目名称:edlara,代码行数:62,代码来源:DatabaseSeeder.php

示例12: run

 public function run()
 {
     Sentry::getUserProvider()->create(array('email' => 'admin@romyrafael.net', 'password' => '123456', 'first_name' => 'Admin', 'last_name' => 'Romy Rafael', 'activated' => 1));
     Sentry::getGroupProvider()->create(array('name' => 'Admin', 'permissions' => array('admin' => 1, 'users' => 1)));
     Sentry::getGroupProvider()->create(array('name' => 'Users', 'permissions' => array('admin' => 0, 'users' => 1)));
     // Assign user permissions
     $adminUser = Sentry::getUserProvider()->findByLogin('admin@romyrafael.net');
     $adminGroup = Sentry::getGroupProvider()->findByName('Admin');
     $adminUser->addGroup($adminGroup);
 }
开发者ID:benhanks040888,项目名称:rmyrfl,代码行数:10,代码来源:SentrySeeder.php

示例13: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users_groups')->delete();
     $adminUser = Sentry::getUserProvider()->findByLogin('admin@example.com');
     $userGroup = Sentry::getGroupProvider()->findByName('Users');
     $adminGroup = Sentry::getGroupProvider()->findByName('Admins');
     // Assign the groups to the users
     $adminUser->addGroup($userGroup);
     $adminUser->addGroup($adminGroup);
 }
开发者ID:edgji,项目名称:sentrystart,代码行数:15,代码来源:SentryUserGroupSeeder.php

示例14: run

 public function run()
 {
     DB::table('users_groups')->delete();
     $user = Sentry::getUserProvider()->findByLogin('user@despark.com');
     $admin = Sentry::getUserProvider()->findByLogin('admin@despark.com');
     $usersGroup = Sentry::getGroupProvider()->findByName('Users');
     $adminsGroup = Sentry::getGroupProvider()->findByName('Admins');
     $user->addGroup($usersGroup);
     $admin->addGroup($adminsGroup);
 }
开发者ID:despark,项目名称:laravel-project-starter,代码行数:10,代码来源:UsersGroupsTableSeeder.php

示例15: run

 /**
  * Run the database seeds.
  *
  * @return void
  */
 public function run()
 {
     DB::table('users_groups')->delete();
     $adminUser = Sentry::getUserProvider()->findByLogin('');
     //initial user email, same as EntryUserSeeder
     $adminGroup = Sentry::getGroupProvider()->findByName('Admins');
     $modGroup = Sentry::getGroupProvider()->findByName('Mods');
     // Assign the groups to the users
     $adminUser->addGroup($modGroup);
     $adminUser->addGroup($adminGroup);
 }
开发者ID:Belar,项目名称:eventpotion,代码行数:16,代码来源:SentryUserGroupSeeder.php


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