Guest User

Untitled

a guest
Oct 11th, 2018
260
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.09 KB | None | 0 0
  1. AUTH_LDAP_SERVER_URI = "ldap://ldap.example.com"
  2. AUTH_LDAP_BIND_DN = 'cn=admin,dc=example,dc=com '
  3. AUTH_LDAP_BIND_PASSWORD = ' '
  4.  
  5. AUTH_LDAP_USER_SEARCH = LDAPSearch(
  6. "ou=people,dc=example,dc=com,
  7. ldap.SCOPE_SUBTREE,
  8. '(uid=%(user)s)',
  9. )
  10.  
  11. AUTH_LDAP_GROUP_SEARCH = LDAPSearch(
  12. 'cn=test_user,ou=people,dc=example,dc=com',
  13. ldap.SCOPE_SUBTREE,
  14. '(objectClass=posixGroup)',
  15. )
  16. AUTH_LDAP_GROUP_TYPE = PosixGroupType()
  17. AUTH_LDAP_REQUIRE_GROUP = 'cn=test_group,ou=group,dc=example,dc=com'
  18.  
  19. AUTH_LDAP_USER_ATTR_MAP = {
  20. 'first_name': 'displayName',
  21. 'last_name': 'sn',
  22. 'email': 'mail',
  23. }
  24.  
  25. AUTH_LDAP_USER_FLAGS_BY_GROUP = {
  26. "is_active":'cn=test_user,ou=people,cn=test_group,ou=group,dc=example,dc=com,
  27.  
  28. }
  29.  
  30. AUTH_LDAP_ALWAYS_UPDATE_USER = True
  31.  
  32. AUTH_LDAP_FIND_GROUP_PERMS = True
  33.  
  34. AUTH_LDAP_CACHE_TIMEOUT = 3600
  35.  
  36. AUTHENTICATION_BACKENDS = (
  37. 'django_auth_ldap.backend.LDAPBackend',
  38. 'django.contrib.auth.backends.ModelBackend',
  39. )
  40.  
  41. # example.com
  42. dn: dc=example,dc=com
  43. dc: example
  44. objectClass: domain
  45.  
  46. # people, example.com
  47. dn: ou=people,dc=example,dc=com
  48. ou: people
  49. objectClass: organizationalUnit
  50.  
  51. # group, example.com
  52. dn: ou=group,dc=example,dc=com
  53. ou: group
  54. objectClass: organizationalUnit
  55.  
  56. # test_user, people, example.com
  57. dn: uid=test_user,ou=people,dc=example,dc=com
  58. objectClass: top
  59. objectClass: posixAccount
  60. objectClass: shadowAccount
  61. objectClass: person
  62. objectClass: organizationalPerson
  63. objectClass: inetOrgPerson
  64. objectClass: sambaSamAccount
  65. objectClass: sambaIdmapEntry
  66. objectClass: apple-user
  67. cn: test_user
  68. sn: test_user
  69. uid: test_user
  70.  
  71. # test_group, group, example.com
  72. dn: cn=test_group,ou=group,dc=example,dc=com
  73. objectClass: top
  74. objectClass: posixGroup
  75. objectClass: sambaGroupMapping
  76. objectClass: sambaIdmapEntry
  77. objectClass: apple-group
  78. cn: test_group
  79. gidNumber: 1000002
  80. sambaGroupType: 2
  81. sambaSID: S-1-5-21-821637849-415082144-557474591-1004
  82. displayName: test_group
  83. memberUid: test_user
  84.  
  85. @has_permission_decorator('view_timeline')
  86. def timeline(request):
  87. if not request.user.is_authenticated():
  88. return redirect('/accounts/login/')
  89. return render(request, 'home.html', {})
Add Comment
Please, Sign In to add comment