From ba8d21f5ae3d4133032c635dad77127cb72ab1bf Mon Sep 17 00:00:00 2001 From: Rob Crittenden Date: Mon, 13 Dec 2010 09:53:29 -0500 Subject: Check for existence of the group when adding a user. The Managed Entries plugin will allow a user to be added even if a group of the same name exists. This would leave the user without a private group. We need to check for both the user and the group so we can do 1 of 3 things: - throw an error that the group exists (but not the user) - throw an error that the user exists (and the group) - allow the uesr to be added ticket 567 --- ipalib/errors.py | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'ipalib/errors.py') diff --git a/ipalib/errors.py b/ipalib/errors.py index 49d6343a..8e119837 100644 --- a/ipalib/errors.py +++ b/ipalib/errors.py @@ -1110,6 +1110,21 @@ class ManagedPolicyError(ExecutionError): errno = 4021 format = _('A managed group cannot have a password policy.') +class ManagedGroupExistsError(ExecutionError): + """ + **4024** Raised when adding a user and its managed group exists + + For example: + + >>> raise ManagedGroupExistsError(group=u'engineering') + Traceback (most recent call last): + ... + ManagedGroupExistsError: Unable to create private group. A group 'engineering' already exists.' + """ + + errno = 4024 + format = _('Unable to create private group. Group \'%(group)s\' already exists.') + class BuiltinError(ExecutionError): """ **4100** Base class for builtin execution errors (*4100 - 4199*). -- cgit