Adldap\Models\User::isDisabled PHP Method

isDisabled() public method

Returns if the user is disabled.
public isDisabled ( ) : boolean
return boolean
    public function isDisabled()
    {
        return ($this->getUserAccountControl() & AccountControl::ACCOUNTDISABLE) === AccountControl::ACCOUNTDISABLE;
    }

Usage Example

Example #1
0
 /**
  * Soft deletes the specified model if the specified AD account is disabled.
  *
  * @param User  $user
  * @param Model $model
  */
 protected function delete(User $user, Model $model)
 {
     if (method_exists($model, 'trashed') && !$model->trashed() && $user->isDisabled()) {
         // If deleting is enabled, the model supports soft deletes, the model
         // isn't already deleted, and the AD user is disabled, we'll
         // go ahead and delete the users model.
         $model->delete();
         if ($this->isLogging()) {
             logger()->info("Soft-deleted user {$user->getCommonName()}. Their AD user account is disabled.");
         }
     }
 }