diff --git a/src/Config/auth.php b/src/Config/auth.php index 19860f1..b4e8be9 100644 --- a/src/Config/auth.php +++ b/src/Config/auth.php @@ -98,6 +98,10 @@ // Only allows users with a uid to authenticate. // Suitable when using OpenLDAP. // Adldap\Laravel\Scopes\UidScope::class, + + // Fetch the userAccountControl attibute + // This is needed on FreeIPA to determine if an user is disabled + // Adldap\Laravel\Scopes\UserAccountControlScope::class, ], diff --git a/src/Scopes/UserAccountControlScope.php b/src/Scopes/UserAccountControlScope.php new file mode 100644 index 0000000..16ad3de --- /dev/null +++ b/src/Scopes/UserAccountControlScope.php @@ -0,0 +1,35 @@ +select($this->getSelectedAttributes($builder)); + } + + /** + * Retrieve the attributes to select for the scope. + * + * This merges the current queries selected attributes so we + * don't overwrite any other scopes selected attributes. + * + * @param Builder $builder + * + * @return array + */ + protected function getSelectedAttributes(Builder $builder) + { + $selected = $builder->getSelects(); + + return array_merge($selected, [ + $builder->getSchema()->userAccountControl(), + ]); + } +}