Forums / Install & configuration / LDAP user groups ActiveDirectory <-> eZ Publish

LDAP user groups ActiveDirectory <-> eZ Publish

Author Message

Philip K.

Monday 31 May 2010 6:55:51 am

Hi there.

I'm trying to set up a site on eZ Publish (version 4.3) with LDAP-Login support. The user login itself is working very well.

Now I want eZ to store the users out of our AD into special groups.

This should work like this:

  • We have created some groups for eZ publish inside our AD
  • These groups were created in eZ, too
  • Roles for these groups were created and assigned
  • If a user logs in he should be created in the same group as he is in the AD

According to the eZ documentation this should work with LDAP Group Mapping Type "SimpleMapping". (http://ez.no/doc/ez_publish/techn...gin_handler/ldap_group_mapping_type)

Ini settings from the documentation are:

LDAPGroupMappingType=SimpleMapping
LDAPUserGroupClass=organizationalUnit
LDAPUserGroupAttribute=cn
LDAPGroupMemberAttribute=members
LDAPUserGroupMap[]
LDAPUserGroupMap[editor]=Editor
LDAPUserGroupMap[techwriter]=Technical writer

I had to change some settings for our need.

My settings in LDAP.ini:

[LDAPSettings]

# Enable tracing the the ldap login, outputs extensive debug info for use during setup
# NOTE: Do not keep this enabled on production setup as login name and passwords will be 
# logged to logfiles or outputted if DebugOutput settings are enabled. 
LDAPDebugTrace=enabled
# Set LDAP version number
LDAPVersion=3
# Set to true if use LDAP server
LDAPEnabled=true
# LDAP host
LDAPServer=<MyHost>

[...]

LDAPGroupMappingType=SimpleMapping
LDAPUserGroupClass=organizationalPerson
LDAPUserGroupAttribute=cn
LDAPGroupMemberAttribute=memberof
LDAPUserGroupMap[]
LDAPUserGroupMap[Group1]=Group1
LDAPUserGroupMap[Group2]=Group2

Problem is that all users are stored in Members-Folder (Node 12) when a user is logging in. Is there someone who has done this before successfully? I don't have any idea why this does not work.

Thanks for your help.

Linux is like a wigwam; no windows, now gates, and apache inside!

Nicolas Pastorino

Wednesday 02 June 2010 10:27:23 am

Hi Philip,

Per @brdesmond reply to my call for help on twitter, it appears that setting "ldapUserGroupClass" to "group" could do the deal. Would you mind trying this out and let us know ?

Thanks to @brdesmond for the help :)
Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Philip K.

Monday 07 June 2010 1:14:25 am

Hi Nicolas,

thank you for your hint.

It still won't work but it was good to find out that there might be an issue in ldap documentation on ez.no.

Here are my current settings in ldap.ini:

# Group mapping settings:
# Root node id where LDAP groups are created, node id: 5 is used if blank
LDAPGroupMappingType=SimpleMapping
LDAPGroupClass=group
#LDAPUserGroupClass=group
LDAPUserGroupAttribute=cn
LDAPGroupMemberAttribute=member
LDAPUserGroupMap[]
LDAPUserGroupMap[eZPublish1]=eZPublish1
LDAPUserGroupMap[eZPublish2]=eZPublish2

As you can see I have two different settings to set the class of a user group:

  • LDAPUserGroupClasss (as it is described in documentation sites: http://ez.no/doc/ez_publish/technical_manual/4_x/features/ldap_login_handler/ldap_group_mapping_type#SimpleMapping )
  • LDAPGroupClass (as it can be found in ldap.ini)

There is no "LDAPUserGroupClass" setting in ldap.ini. I gave it a try anyway and I got the same result as with "LDAPGroupClass": users are still stored in Members-Folder.

I take a look into my error.log and found following enty:

 [ Jun 07 2010 10:03:59 ] [127.0.0.1] eZLDAPUser.php, function getUserGroupsTree():
Missing one of required parameters.

I will try to find out which parameter is needed and tell it here.

Thank you for your help.

Philip

Linux is like a wigwam; no windows, now gates, and apache inside!

Nicolas Pastorino

Monday 07 June 2010 10:37:22 am

Hi Philip,

From the top of my head, investigation can safely start at line 477 in this file :
kernel/classes/datatypes/ezuser/ezldapuser.php (eZ 4.2)

Let us know how things go,
Cheers

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

Philip K.

Tuesday 15 June 2010 2:22:17 am

I got it!

After some 'try & error' I found the correct settings for ldap.ini. Here is how it works now:

  1. Create users in your ActiveDirectory (AD)
  2. Create groups that should be used with eZ Publish in your AD
  3. Create the same groups in eZ Publish
  4. Link users with groups in your AD

If you use "SimpleMapping" method now the user will be created in the same group as he is in your AD.

Here are all ini settings you need to have in your ldap.ini.append.php (based on Windows Active Directory):

[LDAPSettings]
# Enable tracing the the ldap login, outputs extensive debug info for use during setup
# NOTE: Do not keep this enabled on production setup as login name and passwords will be 
# logged to logfiles or outputted if DebugOutput settings are enabled. 
LDAPDebugTrace=enabled
# Set LDAP version number
LDAPVersion=3
# Determines whether the LDAP library automatically follows referrals returned by LDAP servers or not.
# set to 1 to enable
LDAPFollowReferrals=0
# Set to true if use LDAP server
LDAPEnabled=true
# LDAP host
LDAPServer=<YOUR SERVER IP>
# Port nr for LDAP, default is 389
LDAPPort=389
# Specifies the base DN for the directory.
LDAPBaseDn=DC--example,DC--com
# If the server does not allow anonymous bind, specify the user name for the bind here.
LDAPBindUser=administrator@example.com
# If the server does not allow anonymous bind, specify the password for the bind here.
LDAPBindPassword=<YOUR ADMIN PASS>
# Could be sub, one, base.
LDAPSearchScope=sub
# Use the equla sign to replace "=" when specify LDAPBaseDn or LDAPSearchFilters
LDAPEqualSign=--
# Add extra search requirment. Uncomment it if you don't need it.
# Example LDAPSearchFilters[]=objectClass--inetOrgPerson
LDAPSearchFilters[]=objectCategory--person
# LDAP attribute for login. Normally, uid
LDAPLoginAttribute=sAMAccountName

## LDAP GROUP SETTINGS
LDAPGroupBaseDN=DC--example,DC--com
LDAPGroupMappingType=SimpleMapping
LDAPGroupClass=group
LDAPGroupNameAttribute=cn
LDAPGroupMemberAttribute=member
LDAPUserGroupMap[]
LDAPUserGroupMap[eZPublish1]=eZPublish1
LDAPUserGroupMap[eZPublish2]=eZPublish2

Finally I have to say that the example on documentation page for "SimpleMapping" is absolutly wrong!

Thank you Nicolas for your help!

Philip

Linux is like a wigwam; no windows, now gates, and apache inside!

Nicolas Pastorino

Tuesday 15 June 2010 3:15:11 am

Excellent news !

Thansk for sharing the solution !

Cheers,

--
Nicolas Pastorino
Director Community - eZ
Member of the Community Project Board

eZ Publish Community on twitter: http://twitter.com/ezcommunity

t : http://twitter.com/jeanvoye
G+ : http://plus.tl/jeanvoye

eZ debug

Timing: Jan 18 2025 02:45:33
Script start
Timing: Jan 18 2025 02:45:33
Module start 'content'
Timing: Jan 18 2025 02:45:33
Module end 'content'
Timing: Jan 18 2025 02:45:33
Script end

Main resources:

Total runtime0.7303 sec
Peak memory usage4,096.0000 KB
Database Queries205

Timing points:

CheckpointStart (sec)Duration (sec)Memory at start (KB)Memory used (KB)
Script start 0.00000.0058 587.9609180.8047
Module start 'content' 0.00580.6155 768.7656617.6406
Module end 'content' 0.62140.1089 1,386.4063345.3750
Script end 0.7302  1,731.7813 

Time accumulators:

 Accumulator Duration (sec) Duration (%) Count Average (sec)
Ini load
Load cache0.00380.5257210.0002
Check MTime0.00150.2045210.0001
Mysql Total
Database connection0.00080.105710.0008
Mysqli_queries0.646788.54822050.0032
Looping result0.00200.26822030.0000
Template Total0.708397.020.3541
Template load0.00240.322320.0012
Template processing0.705996.663520.3530
Template load and register function0.00010.014810.0001
states
state_id_array0.00080.107210.0008
state_identifier_array0.00070.095420.0003
Override
Cache load0.00210.2862750.0000
Sytem overhead
Fetch class attribute can translate value0.00130.178830.0004
Fetch class attribute name0.00100.134980.0001
XML
Image XML parsing0.00100.142030.0003
class_abstraction
Instantiating content class attribute0.00000.0034120.0000
General
dbfile0.00220.3007330.0001
String conversion0.00000.001030.0000
Note: percentages do not add up to 100% because some accumulators overlap

CSS/JS files loaded with "ezjscPacker" during request:

CacheTypePacklevelSourceFiles
CSS0extension/community/design/community/stylesheets/ext/jquery.autocomplete.css
extension/community_design/design/suncana/stylesheets/scrollbars.css
extension/community_design/design/suncana/stylesheets/tabs.css
extension/community_design/design/suncana/stylesheets/roadmap.css
extension/community_design/design/suncana/stylesheets/content.css
extension/community_design/design/suncana/stylesheets/star-rating.css
extension/community_design/design/suncana/stylesheets/syntax_and_custom_tags.css
extension/community_design/design/suncana/stylesheets/buttons.css
extension/community_design/design/suncana/stylesheets/tweetbox.css
extension/community_design/design/suncana/stylesheets/jquery.fancybox-1.3.4.css
extension/bcsmoothgallery/design/standard/stylesheets/magnific-popup.css
extension/sevenx/design/simple/stylesheets/star_rating.css
extension/sevenx/design/simple/stylesheets/libs/fontawesome/css/all.min.css
extension/sevenx/design/simple/stylesheets/main.v02.css
extension/sevenx/design/simple/stylesheets/main.v02.res.css
JS0extension/ezjscore/design/standard/lib/yui/3.17.2/build/yui/yui-min.js
extension/ezjscore/design/standard/javascript/jquery-3.7.0.min.js
extension/community_design/design/suncana/javascript/jquery.ui.core.min.js
extension/community_design/design/suncana/javascript/jquery.ui.widget.min.js
extension/community_design/design/suncana/javascript/jquery.easing.1.3.js
extension/community_design/design/suncana/javascript/jquery.ui.tabs.js
extension/community_design/design/suncana/javascript/jquery.hoverIntent.min.js
extension/community_design/design/suncana/javascript/jquery.popmenu.js
extension/community_design/design/suncana/javascript/jScrollPane.js
extension/community_design/design/suncana/javascript/jquery.mousewheel.js
extension/community_design/design/suncana/javascript/jquery.cycle.all.js
extension/sevenx/design/simple/javascript/jquery.scrollTo.js
extension/community_design/design/suncana/javascript/jquery.cookie.js
extension/community_design/design/suncana/javascript/ezstarrating_jquery.js
extension/community_design/design/suncana/javascript/jquery.initboxes.js
extension/community_design/design/suncana/javascript/app.js
extension/community_design/design/suncana/javascript/twitterwidget.js
extension/community_design/design/suncana/javascript/community.js
extension/community_design/design/suncana/javascript/roadmap.js
extension/community_design/design/suncana/javascript/ez.js
extension/community_design/design/suncana/javascript/ezshareevents.js
extension/sevenx/design/simple/javascript/main.js

Templates used to render the page:

UsageRequested templateTemplateTemplate loadedEditOverride
1node/view/full.tplfull/forum_topic.tplextension/sevenx/design/simple/override/templates/full/forum_topic.tplEdit templateOverride template
6content/datatype/view/ezimage.tpl<No override>extension/sevenx/design/simple/templates/content/datatype/view/ezimage.tplEdit templateOverride template
6content/datatype/view/ezxmltext.tpl<No override>extension/community_design/design/suncana/templates/content/datatype/view/ezxmltext.tplEdit templateOverride template
18content/datatype/view/ezxmltags/paragraph.tpl<No override>extension/ezwebin/design/ezwebin/templates/content/datatype/view/ezxmltags/paragraph.tplEdit templateOverride template
3content/datatype/view/ezxmltags/li.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/li.tplEdit templateOverride template
2content/datatype/view/ezxmltags/ul.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ul.tplEdit templateOverride template
3content/datatype/view/ezxmltags/link.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/link.tplEdit templateOverride template
5content/datatype/view/ezxmltags/literal.tpl<No override>extension/community/design/standard/templates/content/datatype/view/ezxmltags/literal.tplEdit templateOverride template
3content/datatype/view/ezxmltags/line.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/line.tplEdit templateOverride template
1content/datatype/view/ezxmltags/ol.tpl<No override>design/standard/templates/content/datatype/view/ezxmltags/ol.tplEdit templateOverride template
1pagelayout.tpl<No override>extension/sevenx/design/simple/templates/pagelayout.tplEdit templateOverride template
 Number of times templates used: 49
 Number of unique templates used: 11

Time used to render debug report: 0.0002 secs