AUTH_LDAP_REQUIRE_GROUP = (
(
LDAPGroupQuery("CN=All Users,OU=Groups,OU=Network,DC=corp,DC=com")
)
)
# Define special user types using groups. Exercise great caution when assigning superuser status.
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_staff": (
LDAPGroupQuery("CN=Admins,OU=Groups,OU=Network,DC=corp,DC=com")
),
"is_active": (
LDAPGroupQuery("CN=All users,OU=Groups,OU=Network,DC=corp,DC=com")
),
"is_ipam_admin": (
LDAPGroupQuery("CN=Technical-Support,OU=Groups,OU=Network,DC=corp,DC=com")
),
"is_superuser": (
LDAPGroupQuery("CN=Admins,OU=Groups,OU=Network,DC=corp,DC=com")
)
}
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("OU=Groups,OU=Network,DC=corp,DC=com", ldap.SCOPE_SUBTREE,"(objectClass=group)")
AUTH_LDAP_GROUP_TYPE = NestedGroupOfNamesType()
AUTH_LDAP_FIND_GROUP_PERMS = True
If I understand correctly, you want to do something similar to this? (if I misunderstood, sorry…)
from django_auth_ldap.config import LDAPSearch, GroupOfNamesType, NestedGroupOfNamesType, LDAPGroupQuery
AUTH_LDAP_GROUP_SEARCH = LDAPSearch("DC=corp,DC=local", ldap.SCOPE_SUBTREE,
"(objectClass=group)")
AUTH_LDAP_GROUP_TYPE = NestedGroupOfNamesType()
AUTH_LDAP_REQUIRE_GROUP = (
LDAPGroupQuery("CN=minions,OU=Groups,OU=Global,OU=Sites,DC=corp,DC=local") |
LDAPGroupQuery("CN=more_minions,OU=Groups,OU=Global,OU=Sites,DC=corp,DC=local") |
LDAPGroupQuery("cn=bigshots,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local")
)
# Define special user types using groups. Exercise great caution when assigning superuser status.
AUTH_LDAP_USER_FLAGS_BY_GROUP = {
"is_active": [ "cn=minions,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local",
"cn=more_minions,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local",
"cn=bigshots,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local"],
"is_staff": ["cn=minions,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local",
"cn=bigshots,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local"],
"is_superuser": "cn=network-gods,ou=Groups,ou=Global,ou=Sites,dc=corp,dc=local"
}
# For more granular permissions, we can map LDAP groups to Django groups.
AUTH_LDAP_FIND_GROUP_PERMS = True
And yes, users who are in “network-gods” would probably also have to be in one of the “require” groups in my case.
HTH,
Frank
--
You received this message because you are subscribed to the Google Groups "NetBox" group.
To unsubscribe from this group and stop receiving emails from it, send an email to netbox-discus...@googlegroups.com.
To post to this group, send email to netbox-...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/netbox-discuss/f83b0cf9-eb92-49e9-993f-6dad47bfbcc3%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
"Group1": [ "CN=Group1,OU=Groups,OU=Network,DC=corp,DC=com" ],
"Group2": [ "CN=Group2,OU=Groups,OU=Network,DC=corp,DC=com" ],
"Group3": [ "CN=Group3,OU=Groups,OU=Network,DC=corp,DC=com" ],
"Group4": [ "CN=Group4,OU=Groups,OU=Network,DC=corp,DC=com" ],