mirror of
https://salsa.debian.org/freeipa-team/freeipa.git
synced 2025-02-25 18:55:28 -06:00
ca-del: require CA to already be disabled
Currently ca-del disables the target CA before deleting it. Conceptually, this involves two separate permissions: modify and delete. A user with delete permission does not necessarily have modify permission. As we head toward enforcing IPA permissions in Dogtag, it is necessary to decouple disablement from deletion, otherwise the disable operation shall fail if the user does not have modify permission. Although it introduces an additional step for administrators, the process is consistent, required permissions map 1:1 to the operations, and the error messages make it clear what needs to happen (i.e. disable first). Part of: https://fedorahosted.org/freeipa/ticket/5011 Reviewed-By: Rob Crittenden <rcritten@redhat.com>
This commit is contained in:
committed by
Rob Crittenden
parent
80794f6b5e
commit
5ab24ddf8a
@@ -342,7 +342,12 @@ class ca_del(LDAPDelete):
|
||||
|
||||
ca_id = self.api.Command.ca_show(keys[0])['result']['ipacaid'][0]
|
||||
with self.api.Backend.ra_lightweight_ca as ca_api:
|
||||
ca_api.disable_ca(ca_id)
|
||||
data = ca_api.read_ca(ca_id)
|
||||
if data['enabled']:
|
||||
raise errors.ProtectedEntryError(
|
||||
label=_("CA"),
|
||||
key=keys[0],
|
||||
reason=_("Must be disabled first"))
|
||||
ca_api.delete_ca(ca_id)
|
||||
|
||||
return dn
|
||||
|
||||
Reference in New Issue
Block a user