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
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
die_coolen_jungs
our_own_cloud_project
Commits
6c670cb8
Commit
6c670cb8
authored
May 4, 2012
by
Arthur Schiwon
Browse files
Options
Downloads
Patches
Plain Diff
LDAP: more cleanup
parent
333e8986
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
apps/user_ldap/group_ldap.php
+2
-26
2 additions, 26 deletions
apps/user_ldap/group_ldap.php
with
2 additions
and
26 deletions
apps/user_ldap/group_ldap.php
+
2
−
26
View file @
6c670cb8
...
...
@@ -40,12 +40,10 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
public
function
inGroup
(
$uid
,
$gid
)
{
$dn_user
=
OC_LDAP
::
username2dn
(
$uid
);
$dn_group
=
OC_LDAP
::
groupname2dn
(
$gid
);
// if($dn_group == 'c') {echo('#sdfsdgfds');die($gid);}
// just in case
if
(
!
$dn_group
||
!
$dn_user
)
{
return
false
;
}
// var_dump($dn_group);
$members
=
OC_LDAP
::
readAttribute
(
$dn_group
,
LDAP_GROUP_MEMBER_ASSOC_ATTR
);
return
in_array
(
$dn_user
,
$members
);
...
...
@@ -69,7 +67,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
$this
->
ldapGroupFilter
,
LDAP_GROUP_MEMBER_ASSOC_ATTR
.
'='
.
$userDN
));
$groups
=
$this
->
retrieveList
(
$filter
,
array
(
OC_LDAP
::
conf
(
'ldapGroupDisplayName'
),
'dn'
));
$groups
=
OC_LDAP
::
fetchListOfGroups
(
$filter
,
array
(
OC_LDAP
::
conf
(
'ldapGroupDisplayName'
),
'dn'
));
$userGroups
=
OC_LDAP
::
ownCloudGroupNames
(
$groups
);
return
array_unique
(
$userGroups
,
SORT_LOCALE_STRING
);
...
...
@@ -99,7 +97,7 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
* Returns a list with all groups
*/
public
function
getGroups
()
{
$ldap_groups
=
$this
->
retrieveList
(
$this
->
ldapGroupFilter
,
array
(
OC_LDAP
::
conf
(
'ldapGroupDisplayName'
),
'dn'
));
$ldap_groups
=
OC_LDAP
::
fetchListOfGroups
(
$this
->
ldapGroupFilter
,
array
(
OC_LDAP
::
conf
(
'ldapGroupDisplayName'
),
'dn'
));
$groups
=
OC_LDAP
::
ownCloudGroupNames
(
$ldap_groups
);
return
$groups
;
}
...
...
@@ -112,26 +110,4 @@ class OC_GROUP_LDAP extends OC_Group_Backend {
public
function
groupExists
(
$gid
){
return
in_array
(
$gid
,
$this
->
getGroups
());
}
private
function
retrieveList
(
$filter
,
$attr
,
$searchForGroups
=
true
)
{
if
(
$searchForGroups
)
{
$list
=
OC_LDAP
::
searchGroups
(
$filter
,
$attr
);
}
else
{
$list
=
OC_LDAP
::
searchUsers
(
$filter
,
$attr
);
}
if
(
is_array
(
$list
))
{
if
(
count
(
$attr
)
>
1
){
return
$list
;
}
else
{
return
array_unique
(
$list
,
SORT_LOCALE_STRING
);
}
}
//error cause actually, maybe throw an exception in future.
return
array
();
}
}
\ No newline at end of file
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