Пример #1
0
 /**
  * Attaches roles depending on the users active directory group.
  *
  * @param User       $user
  * @param AdldapUser $adldapUser
  *
  * @return void
  */
 protected function handleLdapUserWasAuthenticated(User $user, AdldapUser $adldapUser)
 {
     if ($adldapUser->inGroup('Help Desk')) {
         $admin = Role::whereName(Role::getAdministratorName())->first();
         // If we have the administrator role and the user isn't
         // already a member, then we'll assign them the role.
         if ($admin instanceof Role && !$user->hasRole($admin)) {
             $user->assignRole($admin);
         }
     }
     $user->from_ad = true;
     $user->save();
 }
Пример #2
0
 /**
  * Attaches roles depending on the users active directory group.
  *
  * @param User       $user
  * @param AdldapUser $adldapUser
  */
 protected function handleLdapUserWasAuthenticated(User $user, AdldapUser $adldapUser)
 {
     if ($adldapUser->inGroup('Help Desk')) {
         $admin = Role::admin();
         if ($admin instanceof Role) {
             $user->attachRole($admin->getKey());
         }
     }
 }