diff options
author | Jakub Hrozek <jhrozek@redhat.com> | 2009-02-02 16:25:09 +0100 |
---|---|---|
committer | Rob Crittenden <rcritten@redhat.com> | 2009-02-10 14:10:35 -0500 |
commit | ee87a281b5d905b02e4f010db6ddc9b2cc333e44 (patch) | |
tree | 373a7e9ee5e60b2a1944893830fe6da764eb21fd | |
parent | 9fe026b47daecb8686c0ade649d5b12cd0cbf6e6 (diff) | |
download | freeipa-ee87a281b5d905b02e4f010db6ddc9b2cc333e44.tar.gz freeipa-ee87a281b5d905b02e4f010db6ddc9b2cc333e44.tar.xz freeipa-ee87a281b5d905b02e4f010db6ddc9b2cc333e44.zip |
Add make_xxx_dn routines for policy
-rw-r--r-- | ipaserver/plugins/b_ldap.py | 77 |
1 files changed, 77 insertions, 0 deletions
diff --git a/ipaserver/plugins/b_ldap.py b/ipaserver/plugins/b_ldap.py index 68e6f4d8e..c205f4144 100644 --- a/ipaserver/plugins/b_ldap.py +++ b/ipaserver/plugins/b_ldap.py @@ -114,6 +114,83 @@ class ldap(CrudBackend): self.api.env.basedn, ) + def make_application_dn(self, appname): + """ + Construct application dn from cn. + """ + return 'cn=%s,%s,%s' % ( + self.dn.escape_dn_chars(appname), + self.api.env.container_applications, + self.api.env.basedn, + ) + + def make_policytemplate_dn(self, appname, uuid): + """ + Construct policytemplate dn from appname + """ + return 'ipaUniqueID=%s,%s' % ( + self.dn.escape_dn_chars(uuid), + self.make_application_dn(appname), + ) + + def make_role_application_dn(self, appname): + """ + Construct application role container from appname + """ + return 'cn=%s,%s,%s' % ( + self.dn.escape_dn_chars(appname), + self.api.env.container_roles, + self.api.env.basedn, + ) + + def make_role_policytemplate_dn(self, appname, uuid): + """ + Construct policytemplate dn from uuid and appname + """ + return 'ipaUniqueID=%s,cn=templates,%s' % ( + self.dn.escape_dn_chars(uuid), + self.make_role_application_dn(appname), + ) + + def make_policygroup_dn(self, uuid): + """ + Construct policygroup dn from uuid + """ + return 'ipaUniqueID=%s,%s,%s' % ( + self.dn.escape_dn_chars(uuid), + self.api.env.container_policygroups, + self.api.env.basedn, + ) + + def make_policy_dn(self, uuid, polgroup_uuid): + """ + Construct policy dn from uuid of policy and its policygroup + """ + return 'ipaUniqueID=%s,%s' % ( + self.dn.escape_dn_chars(uuid), + self.make_policygroup_dn(polgroup_uuid), + ) + + def make_policy_blob_dn(self, blob_uuid, policy_uuid, polgroup_uuid): + """ + Construct policy blob dn from uuids of its policy and policygroup + objects + """ + return 'ipaUniqueID=%s,%s' % ( + self.dn.escape_dn_chars(blob_uuid), + self.make_policy_dn(policy_uuid, polgroup_uuid), + ) + + def make_policylink_dn(self, uuid): + """ + Construct policy link dn from uuid + """ + return 'ipaUniqueID=%s,%s,%s' % ( + self.dn.escape_dn_chars(uuid), + self.api.env.container_policylinks, + self.api.env.basedn, + ) + def get_object_type(self, attribute): """ Based on attribute, make an educated guess as to the type of |