Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"
- AUTH_LDAP_BIND_DN = 'cn=admin,dc=example,dc=com '
- AUTH_LDAP_BIND_PASSWORD = ' '
- AUTH_LDAP_USER_SEARCH = LDAPSearch(
- "ou=people,dc=example,dc=com,
- ldap.SCOPE_SUBTREE,
- '(uid=%(user)s)',
- )
- AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
- 'cn=test_user,ou=people,dc=example,dc=com',
- ldap.SCOPE_SUBTREE,
- '(objectClass=posixGroup)',
- )
- AUTH_LDAP_GROUP_TYPE = PosixGroupType()
- AUTH_LDAP_REQUIRE_GROUP = 'cn=test_group,ou=group,dc=example,dc=com'
- AUTH_LDAP_USER_ATTR_MAP = {
- 'first_name': 'displayName',
- 'last_name': 'sn',
- 'email': 'mail',
- }
- AUTH_LDAP_USER_FLAGS_BY_GROUP = {
- "is_active":'cn=test_user,ou=people,cn=test_group,ou=group,dc=example,dc=com,
- }
- AUTH_LDAP_ALWAYS_UPDATE_USER = True
- AUTH_LDAP_FIND_GROUP_PERMS = True
- AUTH_LDAP_CACHE_TIMEOUT = 3600
- AUTHENTICATION_BACKENDS = (
- 'django_auth_ldap.backend.LDAPBackend',
- 'django.contrib.auth.backends.ModelBackend',
- )
- # example.com
- dn: dc=example,dc=com
- dc: example
- objectClass: domain
- # people, example.com
- dn: ou=people,dc=example,dc=com
- ou: people
- objectClass: organizationalUnit
- # group, example.com
- dn: ou=group,dc=example,dc=com
- ou: group
- objectClass: organizationalUnit
- # test_user, people, example.com
- dn: uid=test_user,ou=people,dc=example,dc=com
- objectClass: top
- objectClass: posixAccount
- objectClass: shadowAccount
- objectClass: person
- objectClass: organizationalPerson
- objectClass: inetOrgPerson
- objectClass: sambaSamAccount
- objectClass: sambaIdmapEntry
- objectClass: apple-user
- cn: test_user
- sn: test_user
- uid: test_user
- # test_group, group, example.com
- dn: cn=test_group,ou=group,dc=example,dc=com
- objectClass: top
- objectClass: posixGroup
- objectClass: sambaGroupMapping
- objectClass: sambaIdmapEntry
- objectClass: apple-group
- cn: test_group
- gidNumber: 1000002
- sambaGroupType: 2
- sambaSID: S-1-5-21-821637849-415082144-557474591-1004
- displayName: test_group
- memberUid: test_user
- @has_permission_decorator('view_timeline')
- def timeline(request):
- if not request.user.is_authenticated():
- return redirect('/accounts/login/')
- return render(request, 'home.html', {})
Add Comment
Please, Sign In to add comment