-
-
Notifications
You must be signed in to change notification settings - Fork 45
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'master' into FEATURE-632
- Loading branch information
Showing
20 changed files
with
233 additions
and
85 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
<?php | ||
|
||
namespace LdapRecord\Models\ActiveDirectory\Concerns; | ||
|
||
use LdapRecord\Models\Attributes\AccountControl; | ||
|
||
trait HasAccountControl | ||
{ | ||
/** | ||
* Determine if the user's account is enabled. | ||
*/ | ||
public function isEnabled(): bool | ||
{ | ||
return ! $this->isDisabled(); | ||
} | ||
|
||
/** | ||
* Determine if the user's account is disabled. | ||
*/ | ||
public function isDisabled(): bool | ||
{ | ||
return $this->accountControl()->hasFlag(AccountControl::ACCOUNTDISABLE); | ||
} | ||
|
||
/** | ||
* Get the user's account control. | ||
*/ | ||
public function accountControl(): AccountControl | ||
{ | ||
return new AccountControl( | ||
$this->getFirstAttribute('userAccountControl') | ||
); | ||
} | ||
|
||
/** | ||
* Set the user's account control attribute. | ||
*/ | ||
public function setUserAccountControlAttribute(mixed $value): void | ||
{ | ||
if ($value instanceof AccountControl) { | ||
$value = $value->getValue(); | ||
} | ||
|
||
$this->attributes['useraccountcontrol'] = [(int) $value]; | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.