From 3d27ba5f0cdb6cd55ad80f44de69c536e12decbe Mon Sep 17 00:00:00 2001 From: nerdalertdk Date: Tue, 2 May 2023 12:01:19 +0200 Subject: [PATCH 1/4] Create UserAccountControlScope.php --- src/Scopes/UserAccountControlScope.php | 1 + 1 file changed, 1 insertion(+) create mode 100644 src/Scopes/UserAccountControlScope.php diff --git a/src/Scopes/UserAccountControlScope.php b/src/Scopes/UserAccountControlScope.php new file mode 100644 index 0000000..8b13789 --- /dev/null +++ b/src/Scopes/UserAccountControlScope.php @@ -0,0 +1 @@ + From f07a061e3bb86cc252daf6a59febbb645dc6a20d Mon Sep 17 00:00:00 2001 From: nerdalertdk Date: Tue, 2 May 2023 12:02:23 +0200 Subject: [PATCH 2/4] Update UserAccountControlScope.php --- src/Scopes/UserAccountControlScope.php | 34 ++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/src/Scopes/UserAccountControlScope.php b/src/Scopes/UserAccountControlScope.php index 8b13789..16ad3de 100644 --- a/src/Scopes/UserAccountControlScope.php +++ b/src/Scopes/UserAccountControlScope.php @@ -1 +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(), + ]); + } +} From 5f4415bea3593c847e8fd0b37e53e7d215651147 Mon Sep 17 00:00:00 2001 From: nerdalertdk Date: Wed, 3 May 2023 12:38:17 +0200 Subject: [PATCH 3/4] Added scope to get field from freeipa server --- src/Config/auth.php | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/Config/auth.php b/src/Config/auth.php index 19860f1..ac41ae5 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, ], From 2f04f6077639541a3d88e0d494ff29c388024215 Mon Sep 17 00:00:00 2001 From: nerdalertdk Date: Wed, 3 May 2023 12:40:41 +0200 Subject: [PATCH 4/4] Typo --- src/Config/auth.php | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Config/auth.php b/src/Config/auth.php index ac41ae5..b4e8be9 100644 --- a/src/Config/auth.php +++ b/src/Config/auth.php @@ -101,7 +101,7 @@ // Fetch the userAccountControl attibute // This is needed on FreeIPA to determine if an user is disabled - Adldap\Laravel\Scopes\UserAccountControlScope::class, + // Adldap\Laravel\Scopes\UserAccountControlScope::class, ],