Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
O
our_own_cloud_project
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
f7fc0067
Commit
f7fc0067
authored
10 years ago
by
Vincent Petry
Browse files
Options
Downloads
Patches
Plain Diff
Revert "[WIP] fix retrieval of group members and cache group members"
parent
3791de64
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/user_ldap/group_ldap.php
+2
-25
2 additions, 25 deletions
apps/user_ldap/group_ldap.php
with
2 additions
and
25 deletions
apps/user_ldap/group_ldap.php
+
2
−
25
View file @
f7fc0067
...
...
@@ -29,11 +29,6 @@ use OCA\user_ldap\lib\BackendUtility;
class
GROUP_LDAP
extends
BackendUtility
implements
\OCP\GroupInterface
{
protected
$enabled
=
false
;
/**
* @var string[] $cachedGroupMembers array of users with gid as key
*/
protected
$cachedGroupMembers
=
array
();
public
function
__construct
(
Access
$access
)
{
parent
::
__construct
(
$access
);
$filter
=
$this
->
access
->
connection
->
ldapGroupFilter
;
...
...
@@ -61,21 +56,6 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
}
$userDN
=
$this
->
access
->
username2dn
(
$uid
);
if
(
isset
(
$this
->
cachedGroupMembers
[
$gid
]))
{
$isInGroup
=
in_array
(
$userDN
,
$this
->
cachedGroupMembers
[
$gid
]);
return
$isInGroup
;
}
$cacheKeyMembers
=
'inGroup-members:'
.
$gid
;
if
(
$this
->
access
->
connection
->
isCached
(
$cacheKeyMembers
))
{
$members
=
$this
->
access
->
connection
->
getFromCache
(
$cacheKeyMembers
);
$this
->
cachedGroupMembers
[
$gid
]
=
$members
;
$isInGroup
=
in_array
(
$userDN
,
$members
);
$this
->
access
->
connection
->
writeToCache
(
$cacheKey
,
$isInGroup
);
return
$isInGroup
;
}
$groupDN
=
$this
->
access
->
groupname2dn
(
$gid
);
// just in case
if
(
!
$groupDN
||
!
$userDN
)
{
...
...
@@ -90,9 +70,8 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
}
//usually, LDAP attributes are said to be case insensitive. But there are exceptions of course.
$members
=
$this
->
_groupMembers
(
$groupDN
);
$members
=
array_keys
(
$members
);
// uids are returned as keys
if
(
!
is_array
(
$members
)
||
count
(
$members
)
===
0
)
{
$members
=
array_keys
(
$this
->
_groupMembers
(
$groupDN
));
if
(
!
$members
)
{
$this
->
access
->
connection
->
writeToCache
(
$cacheKey
,
false
);
return
false
;
}
...
...
@@ -114,8 +93,6 @@ class GROUP_LDAP extends BackendUtility implements \OCP\GroupInterface {
$isInGroup
=
in_array
(
$userDN
,
$members
);
$this
->
access
->
connection
->
writeToCache
(
$cacheKey
,
$isInGroup
);
$this
->
access
->
connection
->
writeToCache
(
$cacheKeyMembers
,
$members
);
$this
->
cachedGroupMembers
[
$gid
]
=
$members
;
return
$isInGroup
;
}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment