2009-06-24 08:12:27 -05:00
|
|
|
# Authors:
|
|
|
|
# Rob Crittenden <rcritten@redhat.com>
|
|
|
|
# Pavel Zuna <pzuna@redhat.com>
|
2009-12-09 10:09:53 -06:00
|
|
|
# Jason Gerard DeRose <jderose@redhat.com>
|
2009-06-24 08:12:27 -05:00
|
|
|
#
|
2009-12-09 10:09:53 -06:00
|
|
|
# Copyright (C) 2008, 2009 Red Hat
|
2009-06-24 08:12:27 -05:00
|
|
|
# see file 'COPYING' for use and warranty information
|
|
|
|
#
|
2010-12-09 06:59:11 -06:00
|
|
|
# This program is free software; you can redistribute it and/or modify
|
|
|
|
# it under the terms of the GNU General Public License as published by
|
|
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
|
|
# (at your option) any later version.
|
2009-06-24 08:12:27 -05:00
|
|
|
#
|
|
|
|
# This program is distributed in the hope that it will be useful,
|
|
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
# GNU General Public License for more details.
|
|
|
|
#
|
|
|
|
# You should have received a copy of the GNU General Public License
|
2010-12-09 06:59:11 -06:00
|
|
|
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
2009-12-09 10:09:53 -06:00
|
|
|
|
2009-06-24 08:12:27 -05:00
|
|
|
"""
|
|
|
|
Test the `ipalib/plugins/user.py` module.
|
|
|
|
"""
|
|
|
|
|
2013-12-10 05:16:25 -06:00
|
|
|
import re
|
|
|
|
|
2013-08-20 08:34:39 -05:00
|
|
|
from ipalib import api, errors
|
2013-05-21 06:40:27 -05:00
|
|
|
from ipatests.test_xmlrpc import objectclasses
|
|
|
|
from ipatests.util import assert_equal, assert_not_equal
|
2013-08-20 08:34:39 -05:00
|
|
|
from xmlrpc_test import (Declarative, fuzzy_digits, fuzzy_uuid, fuzzy_password,
|
|
|
|
fuzzy_string, fuzzy_dergeneralizedtime, add_sid,
|
|
|
|
add_oc)
|
Use DN objects instead of strings
* Convert every string specifying a DN into a DN object
* Every place a dn was manipulated in some fashion it was replaced by
the use of DN operators
* Add new DNParam parameter type for parameters which are DN's
* DN objects are used 100% of the time throughout the entire data
pipeline whenever something is logically a dn.
* Many classes now enforce DN usage for their attributes which are
dn's. This is implmented via ipautil.dn_attribute_property(). The
only permitted types for a class attribute specified to be a DN are
either None or a DN object.
* Require that every place a dn is used it must be a DN object.
This translates into lot of::
assert isinstance(dn, DN)
sprinkled through out the code. Maintaining these asserts is
valuable to preserve DN type enforcement. The asserts can be
disabled in production.
The goal of 100% DN usage 100% of the time has been realized, these
asserts are meant to preserve that.
The asserts also proved valuable in detecting functions which did
not obey their function signatures, such as the baseldap pre and
post callbacks.
* Moved ipalib.dn to ipapython.dn because DN class is shared with all
components, not just the server which uses ipalib.
* All API's now accept DN's natively, no need to convert to str (or
unicode).
* Removed ipalib.encoder and encode/decode decorators. Type conversion
is now explicitly performed in each IPASimpleLDAPObject method which
emulates a ldap.SimpleLDAPObject method.
* Entity & Entry classes now utilize DN's
* Removed __getattr__ in Entity & Entity clases. There were two
problems with it. It presented synthetic Python object attributes
based on the current LDAP data it contained. There is no way to
validate synthetic attributes using code checkers, you can't search
the code to find LDAP attribute accesses (because synthetic
attriutes look like Python attributes instead of LDAP data) and
error handling is circumscribed. Secondly __getattr__ was hiding
Python internal methods which broke class semantics.
* Replace use of methods inherited from ldap.SimpleLDAPObject via
IPAdmin class with IPAdmin methods. Directly using inherited methods
was causing us to bypass IPA logic. Mostly this meant replacing the
use of search_s() with getEntry() or getList(). Similarly direct
access of the LDAP data in classes using IPAdmin were replaced with
calls to getValue() or getValues().
* Objects returned by ldap2.find_entries() are now compatible with
either the python-ldap access methodology or the Entity/Entry access
methodology.
* All ldap operations now funnel through the common
IPASimpleLDAPObject giving us a single location where we interface
to python-ldap and perform conversions.
* The above 4 modifications means we've greatly reduced the
proliferation of multiple inconsistent ways to perform LDAP
operations. We are well on the way to having a single API in IPA for
doing LDAP (a long range goal).
* All certificate subject bases are now DN's
* DN objects were enhanced thusly:
- find, rfind, index, rindex, replace and insert methods were added
- AVA, RDN and DN classes were refactored in immutable and mutable
variants, the mutable variants are EditableAVA, EditableRDN and
EditableDN. By default we use the immutable variants preserving
important semantics. To edit a DN cast it to an EditableDN and
cast it back to DN when done editing. These issues are fully
described in other documentation.
- first_key_match was removed
- DN equalty comparison permits comparison to a basestring
* Fixed ldapupdate to work with DN's. This work included:
- Enhance test_updates.py to do more checking after applying
update. Add test for update_from_dict(). Convert code to use
unittest classes.
- Consolidated duplicate code.
- Moved code which should have been in the class into the class.
- Fix the handling of the 'deleteentry' update action. It's no longer
necessary to supply fake attributes to make it work. Detect case
where subsequent update applies a change to entry previously marked
for deletetion. General clean-up and simplification of the
'deleteentry' logic.
- Rewrote a couple of functions to be clearer and more Pythonic.
- Added documentation on the data structure being used.
- Simplfy the use of update_from_dict()
* Removed all usage of get_schema() which was being called prior to
accessing the .schema attribute of an object. If a class is using
internal lazy loading as an optimization it's not right to require
users of the interface to be aware of internal
optimization's. schema is now a property and when the schema
property is accessed it calls a private internal method to perform
the lazy loading.
* Added SchemaCache class to cache the schema's from individual
servers. This was done because of the observation we talk to
different LDAP servers, each of which may have it's own
schema. Previously we globally cached the schema from the first
server we connected to and returned that schema in all contexts. The
cache includes controls to invalidate it thus forcing a schema
refresh.
* Schema caching is now senstive to the run time context. During
install and upgrade the schema can change leading to errors due to
out-of-date cached schema. The schema cache is refreshed in these
contexts.
* We are aware of the LDAP syntax of all LDAP attributes. Every
attribute returned from an LDAP operation is passed through a
central table look-up based on it's LDAP syntax. The table key is
the LDAP syntax it's value is a Python callable that returns a
Python object matching the LDAP syntax. There are a handful of LDAP
attributes whose syntax is historically incorrect
(e.g. DistguishedNames that are defined as DirectoryStrings). The
table driven conversion mechanism is augmented with a table of
hard coded exceptions.
Currently only the following conversions occur via the table:
- dn's are converted to DN objects
- binary objects are converted to Python str objects (IPA
convention).
- everything else is converted to unicode using UTF-8 decoding (IPA
convention).
However, now that the table driven conversion mechanism is in place
it would be trivial to do things such as converting attributes
which have LDAP integer syntax into a Python integer, etc.
* Expected values in the unit tests which are a DN no longer need to
use lambda expressions to promote the returned value to a DN for
equality comparison. The return value is automatically promoted to
a DN. The lambda expressions have been removed making the code much
simpler and easier to read.
* Add class level logging to a number of classes which did not support
logging, less need for use of root_logger.
* Remove ipaserver/conn.py, it was unused.
* Consolidated duplicate code wherever it was found.
* Fixed many places that used string concatenation to form a new
string rather than string formatting operators. This is necessary
because string formatting converts it's arguments to a string prior
to building the result string. You can't concatenate a string and a
non-string.
* Simplify logic in rename_managed plugin. Use DN operators to edit
dn's.
* The live version of ipa-ldap-updater did not generate a log file.
The offline version did, now both do.
https://fedorahosted.org/freeipa/ticket/1670
https://fedorahosted.org/freeipa/ticket/1671
https://fedorahosted.org/freeipa/ticket/1672
https://fedorahosted.org/freeipa/ticket/1673
https://fedorahosted.org/freeipa/ticket/1674
https://fedorahosted.org/freeipa/ticket/1392
https://fedorahosted.org/freeipa/ticket/2872
2012-05-13 06:36:35 -05:00
|
|
|
from ipapython.dn import DN
|
2009-12-17 07:16:18 -06:00
|
|
|
|
2014-04-29 10:02:34 -05:00
|
|
|
user1 = u'tuser1'
|
|
|
|
user2 = u'tuser2'
|
|
|
|
admin1 = u'admin'
|
|
|
|
admin2 = u'admin2'
|
|
|
|
renameduser1 = u'tuser'
|
|
|
|
group1 = u'group1'
|
|
|
|
admins_group = u'admins'
|
|
|
|
|
|
|
|
invaliduser1 = u'+tuser1'
|
|
|
|
invaliduser2 = u'tuser1234567890123456789012345678901234567890'
|
|
|
|
|
|
|
|
sshpubkey = (u'ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDGAX3xAeLeaJggwTqMjxNwa6X'
|
|
|
|
'HBUAikXPGMzEpVrlLDCZtv00djsFTBi38PkgxBJVkgRWMrcBsr/35lq7P6w8KGI'
|
|
|
|
'wA8GI48Z0qBS2NBMJ2u9WQ2hjLN6GdMlo77O0uJY3251p12pCVIS/bHRSq8kHO2'
|
|
|
|
'No8g7KA9fGGcagPfQH+ee3t7HUkpbQkFTmbPPN++r3V8oVUk5LxbryB3UIIVzNm'
|
|
|
|
'cSIn3JrXynlvui4MixvrtX6zx+O/bBo68o8/eZD26QrahVbA09fivrn/4h3TM01'
|
|
|
|
'9Eu/c2jOdckfU3cHUV/3Tno5d6JicibyaoDDK7S/yjdn5jhaz8MSEayQvFkZkiF'
|
|
|
|
'0L public key test')
|
|
|
|
sshpubkeyfp = (u'13:67:6B:BF:4E:A2:05:8E:AE:25:8B:A1:31:DE:6F:1B '
|
|
|
|
'public key test (ssh-rsa)')
|
|
|
|
|
|
|
|
validlanguage1 = u'en-US;q=0.987 , en, abcdfgh-abcdefgh;q=1 , a;q=1.000'
|
|
|
|
validlanguage2 = u'*'
|
|
|
|
|
|
|
|
invalidlanguage1 = u'abcdfghji-abcdfghji'
|
|
|
|
invalidlanguage2 = u'en-us;q=0,123'
|
|
|
|
invalidlanguage3 = u'en-us;q=0.1234'
|
|
|
|
invalidlanguage4 = u'en-us;q=1.1'
|
|
|
|
invalidlanguage5 = u'en-us;q=1.0000'
|
2009-12-09 10:09:53 -06:00
|
|
|
|
2014-03-27 10:26:08 -05:00
|
|
|
|
2013-12-10 05:16:25 -06:00
|
|
|
# Date in ISO format (2013-12-10T12:00:00)
|
|
|
|
isodate_re = re.compile('^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}Z$')
|
|
|
|
|
2013-09-30 03:50:59 -05:00
|
|
|
|
|
|
|
def get_user_result(uid, givenname, sn, operation='show', omit=[],
|
|
|
|
**overrides):
|
|
|
|
"""Get a user result for a user-{add,mod,find,show} command
|
|
|
|
|
|
|
|
This gives the result as from a user_add(uid, givenname=givenname, sn=sn);
|
|
|
|
modifications to that can be specified in ``omit`` and ``overrides``.
|
|
|
|
|
|
|
|
The ``operation`` can be one of:
|
|
|
|
- add
|
|
|
|
- show
|
|
|
|
- show-all ((show with the --all flag)
|
|
|
|
- find
|
|
|
|
- mod
|
|
|
|
|
|
|
|
Attributes named in ``omit`` are removed from the result; any additional
|
|
|
|
or non-default values can be specified in ``overrides``.
|
|
|
|
"""
|
|
|
|
# sn can be None; this should only be used from `get_admin_result`
|
|
|
|
cn = overrides.get('cn', ['%s %s' % (givenname, sn or '')])
|
|
|
|
cn[0] = cn[0].strip()
|
|
|
|
result = add_sid(dict(
|
|
|
|
homedirectory=[u'/home/%s' % uid],
|
|
|
|
loginshell=[u'/bin/sh'],
|
|
|
|
uid=[uid],
|
|
|
|
uidnumber=[fuzzy_digits],
|
|
|
|
gidnumber=[fuzzy_digits],
|
|
|
|
mail=[u'%s@%s' % (uid, api.env.domain)],
|
|
|
|
has_keytab=False,
|
|
|
|
has_password=False,
|
|
|
|
))
|
|
|
|
if sn:
|
|
|
|
result['sn'] = [sn]
|
|
|
|
if givenname:
|
|
|
|
result['givenname'] = [givenname]
|
|
|
|
if operation in ('add', 'show', 'show-all', 'find'):
|
|
|
|
result.update(
|
|
|
|
dn=get_user_dn(uid),
|
|
|
|
)
|
|
|
|
if operation in ('add', 'show-all'):
|
|
|
|
result.update(
|
|
|
|
cn=cn,
|
|
|
|
displayname=cn,
|
|
|
|
gecos=cn,
|
|
|
|
initials=[givenname[0] + (sn or '')[:1]],
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
|
|
|
mepmanagedentry=[get_group_dn(uid)],
|
|
|
|
objectclass=add_oc(objectclasses.user, u'ipantuserattrs'),
|
|
|
|
krbprincipalname=[u'%s@%s' % (uid, api.env.realm)],
|
|
|
|
)
|
|
|
|
if operation in ('show', 'show-all', 'find', 'mod'):
|
|
|
|
result.update(
|
|
|
|
nsaccountlock=False,
|
|
|
|
)
|
|
|
|
if operation in ('add', 'show', 'show-all', 'mod'):
|
|
|
|
result.update(
|
|
|
|
memberof_group=[u'ipausers'],
|
|
|
|
)
|
|
|
|
for key in omit:
|
|
|
|
del result[key]
|
|
|
|
result.update(overrides)
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
|
|
|
def get_admin_result(operation='show', **overrides):
|
|
|
|
"""Give the result for the default admin user
|
|
|
|
|
|
|
|
Any additional or non-default values can be given in ``overrides``.
|
|
|
|
"""
|
|
|
|
result = get_user_result(u'admin', None, u'Administrator', operation,
|
|
|
|
omit=['mail'],
|
|
|
|
has_keytab=True,
|
|
|
|
has_password=True,
|
|
|
|
loginshell=[u'/bin/bash'],
|
|
|
|
**overrides)
|
|
|
|
return result
|
|
|
|
|
|
|
|
|
2012-08-16 19:28:44 -05:00
|
|
|
def get_user_dn(uid):
|
|
|
|
return DN(('uid', uid), api.env.container_user, api.env.basedn)
|
|
|
|
|
2014-04-29 10:02:34 -05:00
|
|
|
|
2012-08-16 19:28:44 -05:00
|
|
|
def get_group_dn(cn):
|
|
|
|
return DN(('cn', cn), api.env.container_group, api.env.basedn)
|
|
|
|
|
2014-04-29 10:02:34 -05:00
|
|
|
|
2012-02-08 10:00:05 -06:00
|
|
|
def upg_check(response):
|
|
|
|
"""Check that the user was assigned to the corresponding private group."""
|
|
|
|
assert_equal(response['result']['uidnumber'],
|
|
|
|
response['result']['gidnumber'])
|
|
|
|
return True
|
2009-12-09 10:09:53 -06:00
|
|
|
|
2014-04-29 10:02:34 -05:00
|
|
|
|
2012-03-29 08:12:36 -05:00
|
|
|
def not_upg_check(response):
|
2014-04-29 10:02:34 -05:00
|
|
|
"""
|
|
|
|
Check that the user was not assigned to the corresponding
|
|
|
|
private group.
|
|
|
|
"""
|
|
|
|
|
2012-03-29 08:12:36 -05:00
|
|
|
assert_not_equal(response['result']['uidnumber'],
|
|
|
|
response['result']['gidnumber'])
|
|
|
|
return True
|
|
|
|
|
2013-09-30 03:50:59 -05:00
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
class test_user(Declarative):
|
|
|
|
|
|
|
|
cleanup_commands = [
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
('user_del', [user1, user2, renameduser1, admin2], {'continue': True}),
|
2010-12-13 08:53:29 -06:00
|
|
|
('group_del', [group1], {}),
|
2012-09-25 05:20:49 -05:00
|
|
|
('automember_default_group_remove', [], {'type': u'group'}),
|
2009-12-09 10:09:53 -06:00
|
|
|
]
|
|
|
|
|
|
|
|
tests = [
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to retrieve non-existent "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_show', [user1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'%s: user not found' % user1),
|
2009-12-17 07:16:18 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to update non-existent "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_mod', [user1], dict(givenname=u'Foo')),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'%s: user not found' % user1),
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to delete non-existent "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_del', [user1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'%s: user not found' % user1),
|
2009-12-17 07:16:18 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-10-18 13:53:32 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to rename non-existent "%s"' % user1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(setattr=u'uid=%s' % renameduser1)),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'%s: user not found' % user1),
|
2010-10-18 13:53:32 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2009-12-17 07:16:18 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2013-11-12 04:03:28 -06:00
|
|
|
'user_add',
|
|
|
|
[user1],
|
|
|
|
dict(
|
|
|
|
givenname=u'Test',
|
|
|
|
sn=u'User1',
|
|
|
|
userclass=u'testusers'
|
|
|
|
)
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
2009-12-17 07:16:18 -06:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-11-12 04:03:28 -06:00
|
|
|
result=get_user_result(
|
|
|
|
user1,
|
|
|
|
u'Test',
|
|
|
|
u'User1',
|
|
|
|
'add',
|
|
|
|
userclass=[u'testusers'],
|
|
|
|
objectclass=add_oc(
|
|
|
|
objectclasses.user,
|
|
|
|
u'ipantuserattrs'
|
|
|
|
) + [u'ipauser']
|
|
|
|
),
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
2012-02-08 10:00:05 -06:00
|
|
|
extra_check = upg_check,
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to create duplicate "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2010-09-21 12:03:40 -05:00
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1')
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.DuplicateEntry(
|
|
|
|
message=u'user with name "%s" already exists' % user1),
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Retrieve "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2009-12-17 07:16:18 -06:00
|
|
|
'user_show', [user1], {}
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
2013-11-12 04:03:28 -06:00
|
|
|
result=get_user_result(
|
|
|
|
user1,
|
|
|
|
u'Test',
|
|
|
|
u'User1',
|
|
|
|
'show',
|
|
|
|
userclass=[u'testusers']
|
|
|
|
),
|
2009-12-17 07:16:18 -06:00
|
|
|
value=user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
summary=None,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2013-11-12 04:03:28 -06:00
|
|
|
dict(
|
|
|
|
desc='Remove userclass for user "%s"' % user1,
|
|
|
|
command=('user_mod', [user1], dict(userclass=u'')),
|
|
|
|
expected=dict(
|
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod'),
|
|
|
|
value=user1,
|
|
|
|
summary=u'Modified user "%s"' % user1,
|
|
|
|
),
|
|
|
|
),
|
2009-12-09 10:09:53 -06:00
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Search for "%s" with all=True' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2009-12-17 07:16:18 -06:00
|
|
|
'user_find', [user1], {'all': True}
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
2009-12-17 07:16:18 -06:00
|
|
|
result=[
|
2013-11-12 04:03:28 -06:00
|
|
|
get_user_result(
|
|
|
|
user1,
|
|
|
|
u'Test',
|
|
|
|
u'User1',
|
|
|
|
'show-all',
|
|
|
|
objectclass=add_oc(
|
|
|
|
objectclasses.user,
|
|
|
|
u'ipantuserattrs'
|
|
|
|
) + [u'ipauser']
|
|
|
|
),
|
2009-12-17 07:16:18 -06:00
|
|
|
],
|
2009-12-09 10:09:53 -06:00
|
|
|
summary=u'1 user matched',
|
2010-02-12 15:34:21 -06:00
|
|
|
count=1, truncated=False,
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-10-26 04:12:38 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Search for "%s" with pkey-only=True' % user1,
|
2011-10-26 04:12:38 -05:00
|
|
|
command=(
|
|
|
|
'user_find', [user1], {'pkey_only': True}
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
result=[
|
|
|
|
{
|
2012-08-16 19:28:44 -05:00
|
|
|
'dn': get_user_dn(user1),
|
2011-10-26 04:12:38 -05:00
|
|
|
'uid': [user1],
|
|
|
|
},
|
|
|
|
],
|
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1, truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Search for "%s" with minimal attributes' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2009-12-17 07:16:18 -06:00
|
|
|
'user_find', [user1], {}
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
2009-12-17 07:16:18 -06:00
|
|
|
result=[
|
2013-09-30 03:50:59 -05:00
|
|
|
get_user_result(user1, u'Test', u'User1', 'find'),
|
2009-12-17 07:16:18 -06:00
|
|
|
],
|
2009-12-09 10:09:53 -06:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Search for all users',
|
|
|
|
command=(
|
|
|
|
'user_find', [], {}
|
|
|
|
),
|
|
|
|
expected=dict(
|
2009-12-17 07:16:18 -06:00
|
|
|
result=[
|
2013-09-30 03:50:59 -05:00
|
|
|
get_admin_result('find'),
|
|
|
|
get_user_result(user1, u'Test', u'User1', 'find'),
|
2009-12-17 07:16:18 -06:00
|
|
|
],
|
2009-12-09 10:09:53 -06:00
|
|
|
summary=u'2 users matched',
|
|
|
|
count=2,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-08-18 13:04:58 -05:00
|
|
|
dict(
|
|
|
|
desc='Search for all users with a limit of 1',
|
|
|
|
command=(
|
|
|
|
'user_find', [], dict(sizelimit=1,),
|
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=[get_admin_result('find')],
|
2010-08-18 13:04:58 -05:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=True,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Disable "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2010-10-05 14:37:37 -05:00
|
|
|
'user_disable', [user1], {}
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
result=True,
|
2009-12-17 07:16:18 -06:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Disabled user account "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-05-21 04:03:21 -05:00
|
|
|
dict(
|
|
|
|
desc='Assert user is disabled',
|
|
|
|
command=('user_find', [user1], {}),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=[get_user_result(user1, u'Test', u'User1', 'find',
|
|
|
|
nsaccountlock=True)],
|
2012-05-21 04:03:21 -05:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
2009-12-09 10:09:53 -06:00
|
|
|
|
|
|
|
dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
desc='Enable "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2010-10-05 14:37:37 -05:00
|
|
|
'user_enable', [user1], {}
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
result=True,
|
2009-12-17 07:16:18 -06:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Enabled user account "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-05-21 04:03:21 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Assert user "%s" is enabled' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
command=('user_find', [user1], {}),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=[get_user_result(user1, u'Test', u'User1', 'find')],
|
2012-05-21 04:03:21 -05:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Disable "%s" using setattr' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
command=('user_mod', [user1], dict(setattr=u'nsaccountlock=True')),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod',
|
|
|
|
nsaccountlock=True),
|
2012-05-21 04:03:21 -05:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Modified user "%s"' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Enable "%s" using setattr' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
command=('user_mod', [user1], dict(setattr=u'nsaccountlock=False')),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod'),
|
2012-05-21 04:03:21 -05:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Modified user "%s"' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Disable "%s" using user_mod' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
command=('user_mod', [user1], dict(nsaccountlock=True)),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod',
|
|
|
|
nsaccountlock=True),
|
2012-05-21 04:03:21 -05:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Modified user "%s"' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Enable "%s" using user_mod' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
command=('user_mod', [user1], dict(nsaccountlock=False)),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod'),
|
2012-05-21 04:03:21 -05:00
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Modified user "%s"' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try setting virtual attribute on "%s" using setattr' % user1,
|
2012-05-21 04:03:21 -05:00
|
|
|
command=('user_mod', [user1], dict(setattr=u'random=xyz123')),
|
|
|
|
expected=errors.ObjectclassViolation(
|
|
|
|
info='attribute "random" not allowed'),
|
|
|
|
),
|
2009-12-09 10:09:53 -06:00
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Update "%s"' % user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
command=(
|
2009-12-17 07:16:18 -06:00
|
|
|
'user_mod', [user1], dict(givenname=u'Finkle')
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Finkle', u'User1', 'mod'),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Modified user "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
value=user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-05-16 16:39:23 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try updating the krb ticket policy of "%s"' % user1,
|
2011-05-16 16:39:23 -05:00
|
|
|
command=(
|
|
|
|
'user_mod', [user1], dict(setattr=u'krbmaxticketlife=88000')
|
|
|
|
),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.ObjectclassViolation(
|
|
|
|
info=u'attribute "krbmaxticketlife" not allowed'),
|
2011-05-16 16:39:23 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Retrieve "%s" to verify update' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_show', [user1], {}),
|
2009-12-09 10:09:53 -06:00
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Finkle', u'User1', 'show'),
|
2009-12-09 10:09:53 -06:00
|
|
|
summary=None,
|
2009-12-17 07:16:18 -06:00
|
|
|
value=user1,
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-10-18 13:53:32 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Rename "%s"' % user1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(setattr=u'uid=%s' % renameduser1)),
|
2010-10-18 13:53:32 -05:00
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
renameduser1, u'Finkle', u'User1', 'mod',
|
2012-07-23 13:00:51 -05:00
|
|
|
mail=[u'%s@%s' % (user1, api.env.domain)],
|
2013-09-30 03:50:59 -05:00
|
|
|
homedirectory=[u'/home/%s' % user1]),
|
2010-10-18 13:53:32 -05:00
|
|
|
summary=u'Modified user "%s"' % user1,
|
|
|
|
value=user1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Rename "%s" to same value' % renameduser1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [renameduser1],
|
|
|
|
dict(setattr=u'uid=%s' % renameduser1)),
|
2010-10-18 13:53:32 -05:00
|
|
|
expected=errors.EmptyModlist(),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Rename back "%s"' % renameduser1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [renameduser1],
|
|
|
|
dict(setattr=u'uid=%s' % user1)),
|
2010-10-18 13:53:32 -05:00
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Finkle', u'User1', 'mod'),
|
2010-10-18 13:53:32 -05:00
|
|
|
summary=u'Modified user "%s"' % renameduser1,
|
|
|
|
value=renameduser1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_del', [user1], {}),
|
2009-12-09 10:09:53 -06:00
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to delete non-existent "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_del', [user1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'tuser1: user not found'),
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-05-16 16:39:23 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create user "%s" with krb ticket policy' % user1,
|
2011-05-16 16:39:23 -05:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
setattr=u'krbmaxticketlife=88000')
|
|
|
|
),
|
2014-04-29 10:02:34 -05:00
|
|
|
expected=errors.ObjectclassViolation(
|
|
|
|
info='attribute "krbmaxticketlife" not allowed'),
|
2011-05-16 16:39:23 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-09-03 08:33:30 -05:00
|
|
|
dict(
|
|
|
|
desc='Create "%s" with SSH public key' % user1,
|
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
ipasshpubkey=[sshpubkey])
|
2012-09-03 08:33:30 -05:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user1, u'Test', u'User1', 'add',
|
2013-08-20 08:34:39 -05:00
|
|
|
objectclass=add_oc(objectclasses.user, u'ipantuserattrs'),
|
2012-09-03 08:33:30 -05:00
|
|
|
ipasshpubkey=[sshpubkey],
|
|
|
|
sshpubkeyfp=[sshpubkeyfp],
|
2013-09-30 03:50:59 -05:00
|
|
|
),
|
2012-09-03 08:33:30 -05:00
|
|
|
),
|
|
|
|
extra_check = upg_check,
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Add an illegal SSH public key to "%r"' % user1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(ipasshpubkey=[u"anal nathrach orth' bhais's bethad "
|
|
|
|
"do che'l de'nmha"])),
|
2012-09-03 08:33:30 -05:00
|
|
|
expected=errors.ValidationError(name='sshpubkey',
|
|
|
|
error=u'invalid SSH public key'),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete "%s"' % user1,
|
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-09-03 08:33:30 -05:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2012-09-03 08:33:30 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-09-21 12:03:40 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s"' % user1,
|
2010-09-21 12:03:40 -05:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'add'),
|
2010-09-21 12:03:40 -05:00
|
|
|
),
|
2012-02-08 10:00:05 -06:00
|
|
|
extra_check = upg_check,
|
2010-09-21 12:03:40 -05:00
|
|
|
),
|
|
|
|
|
2011-01-07 10:17:55 -06:00
|
|
|
|
2010-09-21 12:03:40 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s"' % user2,
|
2010-09-21 12:03:40 -05:00
|
|
|
command=(
|
|
|
|
'user_add', [user2], dict(givenname=u'Test', sn=u'User2')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user2,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user2,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user2, u'Test', u'User2', 'add'),
|
2010-09-21 12:03:40 -05:00
|
|
|
),
|
2012-02-08 10:00:05 -06:00
|
|
|
extra_check = upg_check,
|
2010-09-21 12:03:40 -05:00
|
|
|
),
|
|
|
|
|
2011-01-07 10:17:55 -06:00
|
|
|
|
2011-04-22 08:43:31 -05:00
|
|
|
dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
desc='Make non-existent "%s" the manager of "%s"' % (renameduser1,
|
|
|
|
user2),
|
2011-04-22 08:43:31 -05:00
|
|
|
command=('user_mod', [user2], dict(manager=renameduser1)),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'manager %s not found' % renameduser1),
|
2011-04-22 08:43:31 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Make "%s" the manager of "%s"' % (user1, user2),
|
2011-04-22 08:43:31 -05:00
|
|
|
command=('user_mod', [user2], dict(manager=user1)),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user2, u'Test', u'User2', 'mod',
|
|
|
|
manager=[user1]),
|
2011-04-22 08:43:31 -05:00
|
|
|
summary=u'Modified user "%s"' % user2,
|
|
|
|
value=user2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-09-03 11:05:17 -05:00
|
|
|
dict(
|
|
|
|
desc='Search for "%s" with manager "%s"' % (user2, user1),
|
|
|
|
command=(
|
|
|
|
'user_find', [user2], {'manager': user1}
|
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=[get_user_result(user2, u'Test', u'User2', 'find',
|
|
|
|
manager=[user1])],
|
2012-09-03 11:05:17 -05:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
2011-04-22 08:43:31 -05:00
|
|
|
|
2010-09-21 12:03:40 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s" and "%s" at the same time' % (user1, user2),
|
2010-09-21 12:03:40 -05:00
|
|
|
command=('user_del', [user1, user2], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2010-09-21 12:03:40 -05:00
|
|
|
summary=u'Deleted user "tuser1,tuser2"',
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1, user2],
|
2010-09-21 12:03:40 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to retrieve non-existent "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_show', [user1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'%s: user not found' % user1),
|
2009-12-17 07:16:18 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to update non-existent "%s"' % user1,
|
2009-12-17 07:16:18 -06:00
|
|
|
command=('user_mod', [user1], dict(givenname=u'Foo')),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(reason=u'%s: user not found' % user1),
|
2009-12-09 10:09:53 -06:00
|
|
|
),
|
2009-06-24 08:12:27 -05:00
|
|
|
|
2009-12-17 07:16:18 -06:00
|
|
|
|
2010-07-27 15:35:23 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Test an invalid login name "%s"' % invaliduser1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_add', [invaliduser1], dict(givenname=u'Test',
|
|
|
|
sn=u'User1')),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.ValidationError(name='login',
|
|
|
|
error=u'may only include letters, numbers, _, -, . and $'),
|
2010-07-27 15:35:23 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Test a login name that is too long "%s"' % invaliduser2,
|
2012-03-27 08:27:11 -05:00
|
|
|
command=('user_add', [invaliduser2],
|
|
|
|
dict(givenname=u'Test', sn=u'User1')),
|
|
|
|
expected=errors.ValidationError(name='login',
|
|
|
|
error='can be at most 32 characters'),
|
2010-07-27 15:35:23 -05:00
|
|
|
),
|
|
|
|
|
2012-02-29 12:31:20 -06:00
|
|
|
|
|
|
|
# The assumption on these next 4 tests is that if we don't get a
|
|
|
|
# validation error then the request was processed normally.
|
|
|
|
dict(
|
|
|
|
desc='Test that validation is disabled on deletes',
|
|
|
|
command=('user_del', [invaliduser1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: user not found' % invaliduser1),
|
2012-02-29 12:31:20 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test that validation is disabled on show',
|
|
|
|
command=('user_show', [invaliduser1], {}),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason=u'%s: user not found' % invaliduser1),
|
2012-02-29 12:31:20 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test that validation is disabled on find',
|
|
|
|
command=('user_find', [invaliduser1], {}),
|
|
|
|
expected=dict(
|
|
|
|
count=0,
|
|
|
|
truncated=False,
|
|
|
|
summary=u'0 users matched',
|
|
|
|
result=[],
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to rename to invalid username "%s"' % user1,
|
2012-02-29 12:31:20 -06:00
|
|
|
command=('user_mod', [user1], dict(rename=invaliduser1)),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.ValidationError(name='rename',
|
|
|
|
error=u'may only include letters, numbers, _, -, . and $'),
|
2012-02-29 12:31:20 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2012-04-03 08:23:39 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to rename to a username that is too long "%s"' % user1,
|
2012-04-03 08:23:39 -05:00
|
|
|
command=('user_mod', [user1], dict(rename=invaliduser2)),
|
2012-03-27 08:27:11 -05:00
|
|
|
expected=errors.ValidationError(name='login',
|
|
|
|
error='can be at most 32 characters'),
|
2012-04-03 08:23:39 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
|
2010-12-13 08:53:29 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s"' % group1,
|
2010-12-13 08:53:29 -06:00
|
|
|
command=(
|
|
|
|
'group_add', [group1], dict(description=u'Test desc')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=group1,
|
|
|
|
summary=u'Added group "%s"' % group1,
|
|
|
|
result=dict(
|
|
|
|
cn=[group1],
|
|
|
|
description=[u'Test desc'],
|
|
|
|
gidnumber=[fuzzy_digits],
|
|
|
|
objectclass=objectclasses.group + [u'posixgroup'],
|
|
|
|
ipauniqueid=[fuzzy_uuid],
|
2012-08-16 19:28:44 -05:00
|
|
|
dn=get_group_dn(group1),
|
2010-12-13 08:53:29 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to user "%s" where the managed group exists' % group1,
|
2010-12-13 08:53:29 -06:00
|
|
|
command=(
|
|
|
|
'user_add', [group1], dict(givenname=u'Test', sn=u'User1')
|
|
|
|
),
|
|
|
|
expected=errors.ManagedGroupExistsError(group=group1)
|
|
|
|
),
|
|
|
|
|
|
|
|
|
2011-02-02 13:16:27 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s" with a full address' % user1,
|
2011-02-02 13:16:27 -06:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
2011-02-18 00:12:04 -06:00
|
|
|
street=u'123 Maple Rd', l=u'Anytown', st=u'MD',
|
2011-04-05 16:26:35 -05:00
|
|
|
telephonenumber=u'410-555-1212', postalcode=u'01234-5678')
|
2011-02-02 13:16:27 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user1, u'Test', u'User1', 'add',
|
|
|
|
street=[u'123 Maple Rd'], l=[u'Anytown'], st=[u'MD'],
|
2011-02-02 13:16:27 -06:00
|
|
|
telephonenumber=[u'410-555-1212'],
|
2013-09-30 03:50:59 -05:00
|
|
|
postalcode=[u'01234-5678'],
|
|
|
|
),
|
2011-02-02 13:16:27 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user1,
|
2011-02-02 13:16:27 -06:00
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2011-02-02 13:16:27 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2011-12-12 05:59:06 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s" with random password' % user1,
|
2011-12-12 05:59:06 -06:00
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
random=True)
|
2011-12-12 05:59:06 -06:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user1, u'Test', u'User1', 'add',
|
2011-12-12 05:59:06 -06:00
|
|
|
randompassword=fuzzy_password,
|
2013-09-30 03:50:59 -05:00
|
|
|
has_keytab=True, has_password=True,
|
2011-12-12 05:59:06 -06:00
|
|
|
krbextradata=[fuzzy_string],
|
|
|
|
krbpasswordexpiration=[fuzzy_dergeneralizedtime],
|
2013-09-30 03:50:59 -05:00
|
|
|
krblastpwdchange=[fuzzy_dergeneralizedtime]
|
|
|
|
),
|
2011-12-12 05:59:06 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user1,
|
2011-12-12 05:59:06 -06:00
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2011-12-12 05:59:06 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s"' % user2,
|
2011-12-12 05:59:06 -06:00
|
|
|
command=(
|
|
|
|
'user_add', [user2], dict(givenname=u'Test', sn=u'User2')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user2,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user2,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user2, u'Test', u'User2', 'add'),
|
2011-12-12 05:59:06 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Modify "%s" with random password' % user2,
|
2011-12-12 05:59:06 -06:00
|
|
|
command=(
|
|
|
|
'user_mod', [user2], dict(random=True)
|
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user2, u'Test', u'User2', 'mod',
|
2011-12-12 05:59:06 -06:00
|
|
|
randompassword=fuzzy_password,
|
2013-09-30 03:50:59 -05:00
|
|
|
has_keytab=True, has_password=True,
|
2011-12-12 05:59:06 -06:00
|
|
|
),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Modified user "%s"' % user2,
|
2011-12-12 05:59:06 -06:00
|
|
|
value=user2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user2,
|
2011-12-12 05:59:06 -06:00
|
|
|
command=('user_del', [user2], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Deleted user "%s"' % user2,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user2],
|
2011-12-12 05:59:06 -06:00
|
|
|
),
|
|
|
|
),
|
2011-02-02 13:16:27 -06:00
|
|
|
|
2011-09-16 08:35:48 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create user "%s" with upper-case principal' % user1,
|
2011-09-16 08:35:48 -05:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
krbprincipalname=user1.upper())
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'add'),
|
2011-09-16 08:35:48 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create user "%s" with bad realm in principal' % user1,
|
2011-09-16 08:35:48 -05:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
krbprincipalname='%s@NOTFOUND.ORG' % user1)
|
|
|
|
),
|
|
|
|
expected=errors.RealmMismatch()
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create user "%s" with malformed principal' % user1,
|
2011-09-16 08:35:48 -05:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
krbprincipalname='%s@BAD@NOTFOUND.ORG' % user1)
|
|
|
|
),
|
2014-04-29 10:02:34 -05:00
|
|
|
expected=errors.MalformedUserPrincipal(
|
|
|
|
principal='%s@BAD@NOTFOUND.ORG' % user1),
|
2011-09-16 08:35:48 -05:00
|
|
|
),
|
|
|
|
|
2012-02-07 06:13:52 -06:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user1,
|
2012-02-07 06:13:52 -06:00
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Change default home directory',
|
|
|
|
command=(
|
|
|
|
'config_mod', [], dict(ipahomesrootdir=u'/other-home'),
|
|
|
|
),
|
2012-06-20 08:08:33 -05:00
|
|
|
expected=lambda x, output: x is None,
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
desc=('Create user "%s" with different default '
|
|
|
|
'home directory' % user1),
|
2012-02-07 06:13:52 -06:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'add',
|
|
|
|
homedirectory=[u'/other-home/tuser1']),
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Reset default home directory',
|
|
|
|
command=(
|
|
|
|
'config_mod', [], dict(ipahomesrootdir=u'/home'),
|
|
|
|
),
|
2012-06-20 08:08:33 -05:00
|
|
|
expected=lambda x, output: x is None,
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user1,
|
2012-02-07 06:13:52 -06:00
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-02-07 06:13:52 -06:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Change default login shell',
|
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'config_mod', [],
|
|
|
|
dict(ipadefaultloginshell=u'/usr/bin/ipython'),
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
2012-06-20 08:08:33 -05:00
|
|
|
expected=lambda x, output: x is None,
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create user "%s" with different default login shell' % user1,
|
2012-02-07 06:13:52 -06:00
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'add',
|
|
|
|
loginshell=[u'/usr/bin/ipython']),
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Reset default login shell',
|
|
|
|
command=(
|
|
|
|
'config_mod', [], dict(ipadefaultloginshell=u'/bin/sh'),
|
|
|
|
),
|
2012-06-20 08:08:33 -05:00
|
|
|
expected=lambda x, output: x is None,
|
2012-02-07 06:13:52 -06:00
|
|
|
),
|
2011-09-16 08:35:48 -05:00
|
|
|
|
2012-03-29 08:12:36 -05:00
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user1,
|
2012-03-29 08:12:36 -05:00
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-03-29 08:12:36 -05:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s" without UPG' % user1,
|
2012-03-29 08:12:36 -05:00
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
noprivate=True)
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
2014-04-29 10:02:34 -05:00
|
|
|
expected=errors.NotFound(
|
|
|
|
reason='Default group for new users is not POSIX'),
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s" without UPG with GID explicitly set' % user2,
|
2012-03-29 08:12:36 -05:00
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'user_add', [user2], dict(givenname=u'Test', sn=u'User2',
|
|
|
|
noprivate=True, gidnumber=1000)
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user2,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user2,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user2, u'Test', u'User2', 'add',
|
2013-08-20 08:34:39 -05:00
|
|
|
objectclass=add_oc(objectclasses.user_base,
|
|
|
|
u'ipantuserattrs'),
|
2012-03-29 08:12:36 -05:00
|
|
|
gidnumber=[u'1000'],
|
2013-09-30 03:50:59 -05:00
|
|
|
description=[],
|
|
|
|
omit=['mepmanagedentry'],
|
|
|
|
),
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Delete "%s"' % user2,
|
2012-03-29 08:12:36 -05:00
|
|
|
command=('user_del', [user2], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-03-29 08:12:36 -05:00
|
|
|
summary=u'Deleted user "%s"' % user2,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user2],
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Change default user group',
|
|
|
|
command=(
|
|
|
|
'config_mod', [], dict(ipadefaultprimarygroup=group1),
|
|
|
|
),
|
2012-06-20 08:08:33 -05:00
|
|
|
expected=lambda x, output: x is None,
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s" without UPG' % user1,
|
2012-03-29 08:12:36 -05:00
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'user_add', [user1], dict(givenname=u'Test', sn=u'User1',
|
|
|
|
noprivate=True)
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user1, u'Test', u'User1', 'add',
|
2013-08-20 08:34:39 -05:00
|
|
|
objectclass=add_oc(objectclasses.user_base,
|
|
|
|
u'ipantuserattrs'),
|
2013-09-30 03:50:59 -05:00
|
|
|
description=[],
|
2012-03-29 08:12:36 -05:00
|
|
|
memberof_group=[group1],
|
2013-09-30 03:50:59 -05:00
|
|
|
omit=['mepmanagedentry'],
|
|
|
|
),
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
extra_check = not_upg_check,
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Create "%s" without UPG with GID explicitly set' % user2,
|
2012-03-29 08:12:36 -05:00
|
|
|
command=(
|
2014-04-29 10:02:34 -05:00
|
|
|
'user_add', [user2], dict(givenname=u'Test', sn=u'User2',
|
|
|
|
noprivate=True, gidnumber=1000)
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user2,
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Added user "%s"' % user2,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user2, u'Test', u'User2', 'add',
|
2013-08-20 08:34:39 -05:00
|
|
|
objectclass=add_oc(objectclasses.user_base,
|
|
|
|
u'ipantuserattrs'),
|
2013-09-30 03:50:59 -05:00
|
|
|
description=[],
|
2012-03-29 08:12:36 -05:00
|
|
|
gidnumber=[u'1000'],
|
|
|
|
memberof_group=[group1],
|
2013-09-30 03:50:59 -05:00
|
|
|
omit=['mepmanagedentry'],
|
|
|
|
),
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
dict(
|
|
|
|
desc='Set %r as manager of %r' % (user1, user2),
|
|
|
|
command=(
|
|
|
|
'user_mod', [user2], dict(manager=user1)
|
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user2, u'Test', u'User2', 'mod',
|
|
|
|
gidnumber=[u'1000'],
|
|
|
|
memberof_group=[group1],
|
|
|
|
manager=[user1]),
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
summary=u'Modified user "%s"' % user2,
|
|
|
|
value=user2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Rename "%s"' % user1,
|
|
|
|
command=('user_mod', [user1], dict(rename=renameduser1)),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
renameduser1, u'Test', u'User1', 'mod',
|
|
|
|
homedirectory=[u'/home/%s' % user1],
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
mail=[u'%s@%s' % (user1, api.env.domain)],
|
|
|
|
memberof_group=[group1],
|
|
|
|
),
|
|
|
|
summary=u'Modified user "%s"' % user1,
|
|
|
|
value=user1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Retrieve %r and check that manager is renamed' % user2,
|
|
|
|
command=(
|
|
|
|
'user_show', [user2], {'all': True}
|
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user2, u'Test', u'User2', 'show-all',
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
gidnumber=[u'1000'],
|
|
|
|
memberof_group=[group1],
|
|
|
|
manager=[renameduser1],
|
2013-09-30 03:50:59 -05:00
|
|
|
objectclass=add_oc(objectclasses.user_base,
|
|
|
|
u'ipantuserattrs'),
|
|
|
|
omit=['mepmanagedentry'],
|
|
|
|
),
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
value=user2,
|
|
|
|
summary=None,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete %r' % renameduser1,
|
|
|
|
command=('user_del', [renameduser1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
summary=u'Deleted user "%s"' % renameduser1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[renameduser1],
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Retrieve %r and check that manager is gone' % user2,
|
|
|
|
command=(
|
|
|
|
'user_show', [user2], {'all': True}
|
|
|
|
),
|
|
|
|
expected=dict(
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user2, u'Test', u'User2', 'show-all',
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
gidnumber=[u'1000'],
|
|
|
|
memberof_group=[group1],
|
2013-09-30 03:50:59 -05:00
|
|
|
objectclass=add_oc(objectclasses.user_base,
|
|
|
|
u'ipantuserattrs'),
|
|
|
|
omit=['mepmanagedentry'],
|
|
|
|
),
|
Expand Referential Integrity checks
Many attributes in IPA (e.g. manager, memberuser, managedby, ...)
are used to store DNs of linked objects in IPA (users, hosts, sudo
commands, etc.). However, when the linked objects is deleted or
renamed, the attribute pointing to it stays with the objects and
thus may create a dangling link causing issues in client software
reading the data.
Directory Server has a plugin to enforce referential integrity (RI)
by checking DEL and MODRDN operations and updating affected links.
It was already used for manager and secretary attributes and
should be expanded for the missing attributes to avoid dangling
links.
As a prerequisite, all attributes checked for RI must have pres
and eq indexes to avoid performance issues. Thus, the following
indexes are added:
* manager (pres index only)
* secretary (pres index only)
* memberHost
* memberUser
* sourcehost
* memberservice
* managedby
* memberallowcmd
* memberdenycmd
* ipasudorunas
* ipasudorunasgroup
Referential Integrity plugin is updated to enforce RI for all these
attributes. Unit tests covering RI checks for all these attributes
were added as well.
Note: this update will only fix RI on one master as RI plugin does
not check replicated operations.
https://fedorahosted.org/freeipa/ticket/2866
2012-09-12 03:00:35 -05:00
|
|
|
value=user2,
|
|
|
|
summary=None,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-03-29 08:12:36 -05:00
|
|
|
dict(
|
|
|
|
desc='Reset default user group',
|
|
|
|
command=(
|
|
|
|
'config_mod', [], dict(ipadefaultprimarygroup=u'ipausers'),
|
|
|
|
),
|
2012-06-20 08:08:33 -05:00
|
|
|
expected=lambda x, output: x is None,
|
2012-03-29 08:12:36 -05:00
|
|
|
),
|
2012-05-23 04:44:53 -05:00
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Try to remove the original admin user "%s"' % admin1,
|
|
|
|
command=('user_del', [admin1], {}),
|
|
|
|
expected=errors.LastMemberError(key=admin1, label=u'group',
|
|
|
|
container=admins_group),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to disable the original admin user "%s"' % admin1,
|
|
|
|
command=('user_disable', [admin1], {}),
|
|
|
|
expected=errors.LastMemberError(key=admin1, label=u'group',
|
|
|
|
container=admins_group),
|
|
|
|
),
|
|
|
|
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create 2nd admin user "%s"' % admin2,
|
|
|
|
command=(
|
|
|
|
'user_add', [admin2], dict(givenname=u'Second', sn=u'Admin')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=admin2,
|
|
|
|
summary=u'Added user "%s"' % admin2,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(admin2, u'Second', u'Admin', 'add'),
|
2012-08-16 19:28:44 -05:00
|
|
|
),
|
2012-05-23 04:44:53 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2012-08-16 19:28:44 -05:00
|
|
|
desc='Add "%s" to the admins group "%s"' % (admin2, admins_group),
|
|
|
|
command=('group_add_member', [admins_group], dict(user=admin2)),
|
2012-05-23 04:44:53 -05:00
|
|
|
expected=dict(
|
|
|
|
completed=1,
|
|
|
|
failed=dict(
|
|
|
|
member=dict(
|
|
|
|
group=tuple(),
|
|
|
|
user=tuple(),
|
|
|
|
),
|
|
|
|
),
|
|
|
|
result={
|
2012-08-16 19:28:44 -05:00
|
|
|
'dn': get_group_dn(admins_group),
|
|
|
|
'member_user': [admin1, admin2],
|
2012-05-23 04:44:53 -05:00
|
|
|
'gidnumber': [fuzzy_digits],
|
2012-08-16 19:28:44 -05:00
|
|
|
'cn': [admins_group],
|
2012-05-23 04:44:53 -05:00
|
|
|
'description': [u'Account administrators group'],
|
|
|
|
},
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-08-16 19:28:44 -05:00
|
|
|
|
2012-05-23 04:44:53 -05:00
|
|
|
dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
desc=('Retrieve admins group "%s" to verify membership is '
|
|
|
|
'"%s","%s"' % (admins_group, admin1, admin2)),
|
2012-08-16 19:28:44 -05:00
|
|
|
command=('group_show', [admins_group], {}),
|
|
|
|
expected=dict(
|
|
|
|
value=admins_group,
|
|
|
|
result=dict(
|
|
|
|
cn=[admins_group],
|
|
|
|
gidnumber=[fuzzy_digits],
|
|
|
|
description=[u'Account administrators group'],
|
|
|
|
dn=get_group_dn(admins_group),
|
|
|
|
member_user=[admin1, admin2],
|
|
|
|
),
|
|
|
|
summary=None,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
desc=('Disable 2nd admin user "%s", admins group "%s" should also '
|
|
|
|
'contain enabled "%s"' % (admin2, admins_group, admin1)),
|
2012-08-16 19:28:44 -05:00
|
|
|
command=(
|
|
|
|
'user_disable', [admin2], {}
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
result=True,
|
|
|
|
value=admin2,
|
|
|
|
summary=u'Disabled user account "%s"' % admin2,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Assert 2nd admin user "%s" is disabled' % admin2,
|
|
|
|
command=('user_find', [admin2], {}),
|
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=[lambda d: d['nsaccountlock'] is True],
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to disable the origin admin user "%s"' % admin1,
|
|
|
|
command=('user_disable', [admin1], {}),
|
|
|
|
expected=errors.LastMemberError(key=admin1, label=u'group',
|
|
|
|
container=admins_group),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to remove the original admin user "%s"' % admin1,
|
|
|
|
command=('user_del', [admin1], {}),
|
|
|
|
expected=errors.LastMemberError(key=admin1, label=u'group',
|
|
|
|
container=admins_group),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete 2nd admin "%s"' % admin2,
|
|
|
|
command=('user_del', [admin2], {}),
|
2012-05-23 04:44:53 -05:00
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'Deleted user "%s"' % admin2,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[admin2],
|
2012-05-23 04:44:53 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2012-08-16 19:28:44 -05:00
|
|
|
dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
desc=('Retrieve admins group "%s" to verify membership is "%s"'
|
|
|
|
% (admins_group, admin1)),
|
2012-08-16 19:28:44 -05:00
|
|
|
command=('group_show', [admins_group], {}),
|
|
|
|
expected=dict(
|
|
|
|
value=admins_group,
|
|
|
|
result=dict(
|
|
|
|
cn=[admins_group],
|
|
|
|
gidnumber=[fuzzy_digits],
|
|
|
|
description=[u'Account administrators group'],
|
|
|
|
dn=get_group_dn(admins_group),
|
|
|
|
member_user=[admin1],
|
|
|
|
),
|
|
|
|
summary=None,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Assert original admin user "%s" is enabled' % admin1,
|
|
|
|
command=('user_find', [admin1], {}),
|
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=[lambda d: d['nsaccountlock'] is False],
|
2012-08-16 19:28:44 -05:00
|
|
|
summary=u'1 user matched',
|
|
|
|
count=1,
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to remove the original admin user "%s"' % admin1,
|
|
|
|
command=('user_del', [admin1], {}),
|
|
|
|
expected=errors.LastMemberError(key=admin1, label=u'group',
|
|
|
|
container=admins_group),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Try to disable the original admin user "%s"' % admin1,
|
|
|
|
command=('user_disable', [admin1], {}),
|
|
|
|
expected=errors.LastMemberError(key=admin1, label=u'group',
|
|
|
|
container=admins_group),
|
|
|
|
),
|
|
|
|
|
2012-09-25 05:20:49 -05:00
|
|
|
dict(
|
|
|
|
desc='Set default automember group for groups as ipausers',
|
|
|
|
command=(
|
|
|
|
'automember_default_group_set', [], dict(
|
|
|
|
type=u'group',
|
|
|
|
automemberdefaultgroup=u'ipausers'
|
|
|
|
)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
result=dict(
|
|
|
|
cn=[u'Group'],
|
2014-04-29 10:02:34 -05:00
|
|
|
automemberdefaultgroup=[DN(('cn', 'ipausers'),
|
|
|
|
('cn', 'groups'),
|
|
|
|
('cn', 'accounts'),
|
|
|
|
api.env.basedn)],
|
2012-09-25 05:20:49 -05:00
|
|
|
),
|
|
|
|
value=u'group',
|
|
|
|
summary=u'Set default (fallback) group for automember "group"',
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete "%s"' % user2,
|
|
|
|
command=('user_del', [user2], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2012-09-25 05:20:49 -05:00
|
|
|
summary=u'Deleted user "%s"' % user2,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user2],
|
2012-09-25 05:20:49 -05:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create %r' % user2,
|
|
|
|
command=(
|
|
|
|
'user_add', [user2], dict(givenname=u'Test', sn=u'User2')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user2,
|
|
|
|
summary=u'Added user "tuser2"',
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user2, u'Test', u'User2', 'add'),
|
2012-09-25 05:20:49 -05:00
|
|
|
),
|
|
|
|
),
|
2013-01-08 03:10:35 -06:00
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create "%s" with UID 999' % user1,
|
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(
|
|
|
|
givenname=u'Test', sn=u'User1', uidnumber=999)
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'add',
|
|
|
|
uidnumber=[u'999'],
|
|
|
|
gidnumber=[u'999']),
|
2013-01-08 03:10:35 -06:00
|
|
|
),
|
|
|
|
extra_check = upg_check,
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Delete "%s"' % user1,
|
|
|
|
command=('user_del', [user1], {}),
|
|
|
|
expected=dict(
|
2014-03-27 08:04:00 -05:00
|
|
|
result=dict(failed=[]),
|
2013-01-08 03:10:35 -06:00
|
|
|
summary=u'Deleted user "%s"' % user1,
|
2014-03-27 08:04:00 -05:00
|
|
|
value=[user1],
|
2013-01-08 03:10:35 -06:00
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Create "%s" with old DNA_MAGIC uid 999' % user1,
|
|
|
|
command=(
|
|
|
|
'user_add', [user1], dict(
|
|
|
|
givenname=u'Test', sn=u'User1', uidnumber=999,
|
|
|
|
version=u'2.49')
|
|
|
|
),
|
|
|
|
expected=dict(
|
|
|
|
value=user1,
|
|
|
|
summary=u'Added user "%s"' % user1,
|
2013-09-30 03:50:59 -05:00
|
|
|
result=get_user_result(
|
|
|
|
user1, u'Test', u'User1', 'add',
|
2013-01-08 03:10:35 -06:00
|
|
|
uidnumber=[lambda v: int(v) != 999],
|
|
|
|
gidnumber=[lambda v: int(v) != 999],
|
2013-09-30 03:50:59 -05:00
|
|
|
),
|
2013-01-08 03:10:35 -06:00
|
|
|
),
|
|
|
|
extra_check = upg_check,
|
|
|
|
),
|
|
|
|
|
2013-09-23 08:02:07 -05:00
|
|
|
dict(
|
|
|
|
desc='Set ipauserauthtype for "%s"' % user1,
|
|
|
|
command=('user_mod', [user1], dict(ipauserauthtype=u'password')),
|
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod',
|
|
|
|
ipauserauthtype=[u'password'],
|
2013-09-23 08:02:07 -05:00
|
|
|
),
|
|
|
|
value=user1,
|
|
|
|
summary='Modified user "%s"' % user1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Retrieve "%s" to verify ipauserauthtype' % user1,
|
|
|
|
command=('user_show', [user1], {}),
|
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'show',
|
|
|
|
ipauserauthtype=[u'password'],
|
2013-09-23 08:02:07 -05:00
|
|
|
),
|
|
|
|
value=user1,
|
|
|
|
summary=None,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Unset ipauserauthtype for "%s"' % user1,
|
|
|
|
command=('user_mod', [user1], dict(ipauserauthtype=None)),
|
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod'),
|
2013-09-23 08:02:07 -05:00
|
|
|
value=user1,
|
|
|
|
summary='Modified user "%s"' % user1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2013-12-10 05:16:25 -06:00
|
|
|
dict(
|
|
|
|
desc='Query status of "%s"' % user1,
|
|
|
|
command=('user_status', [user1], {}),
|
|
|
|
expected=dict(
|
|
|
|
count=1,
|
|
|
|
result=[
|
|
|
|
dict(
|
|
|
|
dn=get_user_dn(user1),
|
|
|
|
krblastfailedauth=[u'N/A'],
|
|
|
|
krblastsuccessfulauth=[u'N/A'],
|
|
|
|
krbloginfailedcount=u'0',
|
|
|
|
now=isodate_re.match,
|
|
|
|
server=api.env.host,
|
|
|
|
),
|
|
|
|
],
|
|
|
|
summary=u'Account disabled: False',
|
|
|
|
truncated=False,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2014-03-27 10:26:08 -05:00
|
|
|
dict(
|
|
|
|
desc='Test an invalid preferredlanguage "%s"' % invalidlanguage1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=invalidlanguage1)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=errors.ValidationError(name='preferredlanguage',
|
2014-04-29 10:02:34 -05:00
|
|
|
error=(u'must match RFC 2068 - 14.4, e.g., '
|
|
|
|
'"da, en-gb;q=0.8, en;q=0.7"')),
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test an invalid preferredlanguage "%s"' % invalidlanguage2,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=invalidlanguage2)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=errors.ValidationError(name='preferredlanguage',
|
2014-04-29 10:02:34 -05:00
|
|
|
error=(u'must match RFC 2068 - 14.4, e.g., '
|
|
|
|
'"da, en-gb;q=0.8, en;q=0.7"')),
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test an invalid preferredlanguage "%s"' % invalidlanguage3,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=invalidlanguage3)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=errors.ValidationError(name='preferredlanguage',
|
2014-04-29 10:02:34 -05:00
|
|
|
error=(u'must match RFC 2068 - 14.4, e.g., '
|
|
|
|
'"da, en-gb;q=0.8, en;q=0.7"')),
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test an invalid preferredlanguage "%s"' % invalidlanguage4,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=invalidlanguage4)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=errors.ValidationError(name='preferredlanguage',
|
2014-04-29 10:02:34 -05:00
|
|
|
error=(u'must match RFC 2068 - 14.4, e.g., '
|
|
|
|
'"da, en-gb;q=0.8, en;q=0.7"')),
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Test an invalid preferredlanguage "%s"' % invalidlanguage5,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=invalidlanguage5)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=errors.ValidationError(name='preferredlanguage',
|
2014-04-29 10:02:34 -05:00
|
|
|
error=(u'must match RFC 2068 - 14.4, e.g., '
|
|
|
|
'"da, en-gb;q=0.8, en;q=0.7"')),
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Set preferredlanguage "%s"' % validlanguage1,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=validlanguage1)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod',
|
|
|
|
preferredlanguage=[validlanguage1],
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
value=user1,
|
|
|
|
summary='Modified user "%s"' % user1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
|
|
|
dict(
|
|
|
|
desc='Set preferredlanguage "%s"' % validlanguage2,
|
2014-04-29 10:02:34 -05:00
|
|
|
command=('user_mod', [user1],
|
|
|
|
dict(preferredlanguage=validlanguage2)),
|
2014-03-27 10:26:08 -05:00
|
|
|
expected=dict(
|
2014-04-29 10:02:34 -05:00
|
|
|
result=get_user_result(user1, u'Test', u'User1', 'mod',
|
|
|
|
preferredlanguage=[validlanguage2],
|
2014-03-27 10:26:08 -05:00
|
|
|
),
|
|
|
|
value=user1,
|
|
|
|
summary='Modified user "%s"' % user1,
|
|
|
|
),
|
|
|
|
),
|
|
|
|
|
2009-12-09 10:09:53 -06:00
|
|
|
]
|