summaryrefslogtreecommitdiffstats
path: root/ipalib/plugins/permission.py
diff options
context:
space:
mode:
authorMartin Kosek <mkosek@redhat.com>2012-06-27 13:10:10 +0200
committerMartin Kosek <mkosek@redhat.com>2012-06-28 15:21:21 +0200
commit52f69aaa8ab4d633bbeb96799bf96e8a715d0ae0 (patch)
treeb5c8661fbf84e32854184b6f378090849767489d /ipalib/plugins/permission.py
parent302d5afe8b16464a26fd9e477b06b71c3b215cf2 (diff)
downloadfreeipa-52f69aaa8ab4d633bbeb96799bf96e8a715d0ae0.tar.gz
freeipa-52f69aaa8ab4d633bbeb96799bf96e8a715d0ae0.tar.xz
freeipa-52f69aaa8ab4d633bbeb96799bf96e8a715d0ae0.zip
Per-domain DNS record permissions
IPA implements read/write permissions for DNS record or zones. Provided set of permissions and privileges can, however, only grant access to the whole DNS tree, which may not be appropriate. Administrators may miss more fine-grained permissions allowing them to delegate access per-zone. Create a new IPA auxiliary objectclass ipaDNSZone allowing a managedBy attribute for a DNS zone. This attribute will hold a group DN (in this case a permission) which allows its members to read or write in a zone. Member permissions in given zone will only have 2 limitations: 1) Members cannot delete the zone 2) Members cannot edit managedBy attribute Current DNS deny ACI used to enforce read access is removed so that DNS privileges are based on allow ACIs only, which is much more flexible approach as deny ACIs have always precedence and limit other extensions. Per-zone access is allowed in 3 generic ACIs placed in cn=dns,$SUFFIX so that no special ACIs has to be added to DNS zones itselves. 2 new commands have been added which allows an administrator to create the system permission allowing the per-zone access and fill a zone's managedBy attribute: * dnszone-add-permission: Add per-zone permission * dnszone-remove-permission: Remove per-zone permission https://fedorahosted.org/freeipa/ticket/2511
Diffstat (limited to 'ipalib/plugins/permission.py')
-rw-r--r--ipalib/plugins/permission.py43
1 files changed, 42 insertions, 1 deletions
diff --git a/ipalib/plugins/permission.py b/ipalib/plugins/permission.py
index 05d19ad8d..ec3d78d1b 100644
--- a/ipalib/plugins/permission.py
+++ b/ipalib/plugins/permission.py
@@ -246,14 +246,55 @@ class permission_add(LDAPCreate):
api.register(permission_add)
+class permission_add_noaci(LDAPCreate):
+ __doc__ = _('Add a system permission without an ACI')
+
+ msg_summary = _('Added permission "%(value)s"')
+ has_output_params = LDAPCreate.has_output_params + output_params
+ NO_CLI = True
+
+ takes_options = (
+ StrEnum('permissiontype?',
+ label=_('Permission type'),
+ values=(u'SYSTEM',),
+ ),
+ )
+
+ def get_args(self):
+ # do not validate system permission names
+ yield self.obj.primary_key.clone(pattern=None, pattern_errmsg=None)
+
+ def get_options(self):
+ for option in super(permission_add_noaci, self).get_options():
+ # filter out ACI options
+ if option.name in self.obj.aci_attributes:
+ continue
+ yield option
+
+ def pre_callback(self, ldap, dn, entry_attrs, attrs_list, *keys, **options):
+ permission_type = options.get('permissiontype')
+ if permission_type:
+ entry_attrs['ipapermissiontype'] = [ permission_type ]
+ return dn
+
+api.register(permission_add_noaci)
+
class permission_del(LDAPDelete):
__doc__ = _('Delete a permission.')
msg_summary = _('Deleted permission "%(value)s"')
+ takes_options = LDAPDelete.takes_options + (
+ Flag('force',
+ label=_('Force'),
+ flags=['no_option', 'no_output'],
+ doc=_('force delete of SYSTEM permissions'),
+ ),
+ )
+
def pre_callback(self, ldap, dn, *keys, **options):
- if not self.obj.check_system(ldap, dn, *keys):
+ if not options.get('force') and not self.obj.check_system(ldap, dn, *keys):
raise errors.ACIError(info='A SYSTEM permission may not be removed')
# remove permission even when the underlying ACI is missing
try: