Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to import users and groups #27

Open
nova-systems opened this issue Oct 20, 2018 · 2 comments
Open

How to import users and groups #27

nova-systems opened this issue Oct 20, 2018 · 2 comments

Comments

@nova-systems
Copy link

I have a working AD server,

your module works and I can log into admin area of django with my administrators group member.

how can I Import all users and groups to django ?
my config

#Active Directory
LDAP_SERVERS = [
{
'host': '10.172.90.3',
'port': 389,
'use_ssl': False,
},
]
LDAP_ENGINE = "AD"
LDAP_BIND_USER = "cn=intranet,ou=EFEKTUM,dc=ad,dc=efektum,dc=pl"
LDAP_BIND_PASSWORD = ""
LDAP_SEARCH_BASE = "dc=ad,dc=efektum,dc=pl"
LDAP_USER_SEARCH_FILTER = "(&(|(userPrincipalName={0})(sAMAccountName={0}))(objectClass=user))"

DAP_USE_LDAP_GROUPS = True
LDAP_GROUPS_SEARCH_BASE = "dc=ad,dc=efektum,dc=pl"
LDAP_GROUPS_SEARCH_FILTER = "(&(objectClass=group))"
LDAP_GROUP_MEMBER_ATTRIBUTE = "member"
LDAP_SUPERUSER_GROUPS = ["CN=Administratorzy,DC=ad,DC=efektum,DC=pl", ]
LDAP_STAFF_GROUPS = ["CN=IT,OU=PROJEKTY,OU=EFEKTUM,DC=ad,DC=efektum,DC=pl", ]
LDAP_GROUPS_MAP = {
'DPD': "CN=DPD,OU=PROJEKTY,OU=EFEKTUM,DC=ad,DC=efektum,DC=pl",
}
LDAP_ATTRIBUTES_MAP = {
'username': 'sAMAccountName',
'first_name': 'givenName',
'last_name': 'sn',
'email': 'mail',
}

@mikedici
Copy link

I have a question about LDAP_GROUPS_MAP = {
'DPD': "CN=DPD,OU=PROJEKTY,OU=EFEKTUM,DC=ad,DC=efektum,DC=pl",
}
you posted this as an answer to my issue and the AD login for regular users works but using the default django admin does not work. I suspect the issue is this line. I see you set the key to this dict as 'DPD', I imagine that you have something refering to 'DPD' in another file to set the group name?

@povtux
Copy link
Member

povtux commented Feb 14, 2020

Hi,
Actually, the module does not import users and groups. The binding LDAP_GROUP_MAP enables you to make django groups match ldap groups. This way, you can limit the number of groups in Django to the minimum and give them the needed rigths without having all the groups of your AD.
So you need to create groups you need and refer to the group name as the key in LDAP_GROUP_MAP.
regards.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants