Skip to content
GitLab
Explore
Projects
Groups
Topics
Snippets
Projects
Groups
Topics
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
fusiondirectory
fusiondirectory
Commits
ceb3ef96
Commit
ceb3ef96
authored
9 years ago
by
Côme Chilliet
Browse files
Options
Download
Patches
Plain Diff
Fixes #4560 Added an option to restrict roles members to group members
parent
425010f0
dev
6342-update-the-locales-for-1-5
6344-template-issue-when-creating-a-template-with-empty-password-error-message-should-not-be-seen
6365-core-locking-mechanism-is-not-changing-the-mail-ressource-it-does-lock-the-mail-account
6365-core-when-lock-mechanism-is-trigger-the-user-should-not-be-editable-if-not-unlock
6378-orcid-test-method-is-wrong-and-break-orcid-saving
core-php8
master
fusiondirectory-1.5
fusiondirectory-1.4
fusiondirectory-1.3.1
fusiondirectory-1.3
fusiondirectory-1.2.3
fusiondirectory-1.2.2
fusiondirectory-1.2.1
fusiondirectory-1.2
fusiondirectory-1.1.1
fusiondirectory-1.1
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
contrib/openldap/core-fd-conf.schema
+7
-1
contrib/openldap/core-fd-conf.schema
include/select/class_filterLDAPBlacklist.inc
+33
-12
include/select/class_filterLDAPBlacklist.inc
include/simpleplugin/class_dialogAttributes.inc
+6
-0
include/simpleplugin/class_dialogAttributes.inc
plugins/admin/groups/class_roleGeneric.inc
+24
-1
plugins/admin/groups/class_roleGeneric.inc
plugins/config/class_configInLdap.inc
+4
-0
plugins/config/class_configInLdap.inc
with
74 additions
and
14 deletions
+74
-14
contrib/openldap/core-fd-conf.schema
+
7
−
1
View file @
ceb3ef96
...
...
@@ -166,6 +166,12 @@ attributetype ( 1.3.6.1.4.1.38414.8.12.18 NAME 'fdCnPattern'
SYNTAX 1.3.6.1.4.1.1466.115.121.1.26
SINGLE-VALUE)
attributetype ( 1.3.6.1.4.1.38414.8.12.19 NAME 'fdRestrictRoleMembers'
DESC 'FusionDirectory - Restrict role members to users from the same LDAP branch'
EQUALITY booleanMatch
SYNTAX 1.3.6.1.4.1.1466.115.121.1.7
SINGLE-VALUE )
# Password
attributetype ( 1.3.6.1.4.1.38414.8.13.1 NAME 'fdPasswordDefaultHash'
...
...
@@ -568,7 +574,7 @@ objectclass ( 1.3.6.1.4.1.38414.8.2.1 NAME 'fusionDirectoryConf'
fdStrictNamingRules $ fdMinId $ fdUidNumberBase $
fdGidNumberBase $ fdUserRDN $ fdGroupRDN $ fdIdAllocationMethod $
fdGidNumberPoolMin $ fdUidNumberPoolMin $ fdGidNumberPoolMax $ fdUidNumberPoolMax $
fdAclRoleRDN $ fdCnPattern $
fdAclRoleRDN $ fdCnPattern $
fdRestrictRoleMembers $
fdPasswordDefaultHash $ fdPasswordMinLength $ fdPasswordMinDiffer $
fdPasswordHook $ fdHandleExpiredAccounts $ fdSaslRealm $ fdSaslExop $
fdForcePasswordDefaultHash $
...
...
This diff is collapsed.
Click to expand it.
include/select/class_filterLDAPBlacklist.inc
+
33
−
12
View file @
ceb3ef96
...
...
@@ -22,30 +22,51 @@
class
filterLDAPBlacklist
{
static
function
query
(
$parent
,
$base
,
$scope
,
$filter
,
$attributes
,
$category
,
$objectStorage
=
""
)
static
function
query
(
$parent
,
$base
,
$scope
,
$filter
,
$attributes
,
$category
,
$objectStorage
=
""
)
{
$result
=
filterLDAP
::
query
(
$parent
,
$base
,
$scope
,
$filter
,
$attributes
,
$category
,
$objectStorage
);
return
(
filterLDAPBlacklist
::
filterByBlacklist
(
$result
)
)
;
$result
=
filterLDAP
::
query
(
$parent
,
$base
,
$scope
,
$filter
,
$attributes
,
$category
,
$objectStorage
);
return
filterLDAPBlacklist
::
filterByBlacklist
(
$result
);
}
static
function
filterByBlacklist
(
$entries
)
{
if
(
session
::
is_set
(
'filterBlacklist'
)){
if
(
session
::
is_set
(
'filterWhitelist'
))
{
$wlist
=
session
::
get
(
'filterWhitelist'
);
if
(
!
empty
(
$wlist
))
{
foreach
(
$entries
as
$id
=>
$entry
)
{
$dn1
=
$entry
[
'dn'
];
$dn2
=
$wlist
[
'dn'
];
if
(
in_array
(
$entry
[
'dn'
],
$wlist
[
'dn'
]))
{
continue
;
}
foreach
(
$wlist
[
'branches'
]
as
$branch
)
{
if
(
preg_match
(
'/'
.
preg_quote
(
$branch
,
'/'
)
.
'$/'
,
$entry
[
'dn'
]))
{
continue
2
;
}
}
unset
(
$entries
[
$id
]);
}
}
}
if
(
session
::
is_set
(
'filterBlacklist'
))
{
$blist
=
session
::
get
(
'filterBlacklist'
);
foreach
(
$blist
as
$attr_name
=>
$attr_values
){
foreach
(
$attr_values
as
$match
){
foreach
(
$entries
as
$id
=>
$entry
){
if
(
isset
(
$entry
[
$attr_name
])){
foreach
(
$blist
as
$attr_name
=>
$attr_values
)
{
foreach
(
$attr_values
as
$match
)
{
foreach
(
$entries
as
$id
=>
$entry
)
{
if
(
isset
(
$entry
[
$attr_name
]))
{
$test
=
$entry
[
$attr_name
];
if
(
!
is_array
(
$test
))
$test
=
array
(
$test
);
if
(
in_array
(
$match
,
$test
))
unset
(
$entries
[
$id
]);
if
(
!
is_array
(
$test
))
{
$test
=
array
(
$test
);
}
if
(
in_array
(
$match
,
$test
))
{
unset
(
$entries
[
$id
]);
}
}
}
}
}
}
return
(
array_values
(
$entries
)
)
;
return
array_values
(
$entries
);
}
}
?>
This diff is collapsed.
Click to expand it.
include/simpleplugin/class_dialogAttributes.inc
+
6
−
0
View file @
ceb3ef96
...
...
@@ -66,6 +66,7 @@ class GenericSelectDialog extends GenericDialog
function
dialog_execute
()
{
session
::
set
(
'filterBlacklist'
,
$this
->
attribute
->
getFilterBlackList
());
session
::
set
(
'filterWhitelist'
,
$this
->
attribute
->
getFilterWhiteList
());
return
parent
::
dialog_execute
();
}
...
...
@@ -189,6 +190,11 @@ class DialogAttribute extends SetAttribute
trigger_error
(
"abstract method"
);
}
function
getFilterWhiteList
()
{
return
array
();
}
function
loadPostValue
()
{
parent
::
loadPostValue
();
...
...
This diff is collapsed.
Click to expand it.
plugins/admin/groups/class_roleGeneric.inc
+
24
−
1
View file @
ceb3ef96
...
...
@@ -18,6 +18,29 @@
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
*/
class
RoleMembersAttribute
extends
UsersAttribute
{
protected
$whitelistDns
=
NULL
;
function
getFilterWhiteList
()
{
global
$config
;
if
(
$config
->
get_cfg_value
(
'RestrictRoleMembers'
)
==
'TRUE'
)
{
if
(
$this
->
whitelistDns
===
NULL
)
{
/* Computes a list of members of all groups within our branch */
$groups
=
objects
::
ls
(
'ogroup'
,
array
(
'member'
=>
'*'
),
$this
->
plugin
->
base
);
$this
->
whitelistDns
=
call_user_func_array
(
'array_merge_recursive'
,
$groups
)[
'member'
];
}
return
array
(
'branches'
=>
array
(
$this
->
plugin
->
base
),
'dn'
=>
$this
->
whitelistDns
,
);
}
else
{
return
array
();
}
}
}
class
roleGeneric
extends
simplePlugin
{
var
$mainTab
=
TRUE
;
...
...
@@ -74,7 +97,7 @@ class roleGeneric extends simplePlugin
_
(
'Fax number'
),
_
(
'Fax number'
),
'facsimileTelephoneNumber'
),
new
Us
ersAttribute
(
new
RoleMemb
ersAttribute
(
_
(
'Users'
),
_
(
'Add users for the role'
),
'roleOccupant'
,
FALSE
)
...
...
This diff is collapsed.
Click to expand it.
plugins/config/class_configInLdap.inc
+
4
−
0
View file @
ceb3ef96
...
...
@@ -363,6 +363,10 @@ class configInLdap extends simplePlugin
'fdGidNumberPoolMax'
,
FALSE
,
0
,
FALSE
,
40000
),
new
BooleanAttribute
(
_
(
'Restrict role members'
),
_
(
'When enabled only users from the same branch or members of groups from the same branch can be added to a role.'
),
'fdRestrictRoleMembers'
),
)
),
'debug'
=>
array
(
...
...
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
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
Menu
Explore
Projects
Groups
Topics
Snippets