Commit Graph

47 Commits

Author SHA1 Message Date
Petr Viktorin
5435a8a32a Use absolute imports
In Python 3, implicit relative imports will not be supported.
Use fully-qualified imports everywhere.

Reviewed-By: Tomas Babej <tbabej@redhat.com>
2015-08-12 18:17:23 +02:00
Nathaniel McCallum
e05dfbd8b4 Add optional_create flag 2013-10-08 16:46:20 +02:00
Petr Viktorin
295ce7bf18 Use correct super-calls in get_args() methods
The get_args methods in ipalib.crud and ipalib.plugins.baseldap used
super() calls that skipped some of the classes in the inheritance
chain, and contained code that reimplemented some of the skipped
functionality.
This made it difficult to customize the get_args behavior.

Use proper super() calls.
2013-10-02 16:09:07 +02:00
Tomas Babej
7f27a18b51 Relax restriction for leading/trailing whitespaces in *-find commands
All *-find commands now enable leading/trailing whitespaces in the
search phrase. Behaviour has been implemented directly into
crud.Search class. IPA_API_VERSION_MINOR incremented to 45.

https://fedorahosted.org/freeipa/ticket/2981
2012-12-11 12:34:28 +01:00
Petr Viktorin
7cfc16ca58 Enforce that required attributes can't be set to None in CRUD Update
The `required` parameter attribute didn't distinguish between cases
where the parameter is not given and all, and where the parameter is
given but empty. The case of updating a required attribute couldn't
be validated properly, because when it is given but empty, validators
don't run.
This patch introduces a new flag, 'nonempty', that specifies the
parameter can be missing (if not required), but it can't be None.
This flag gets added automatically to required parameters in CRUD
Update.
2012-03-12 17:16:14 +01:00
Rob Crittenden
0099ccbea8 Only apply validation rules when adding and updating.
There may be cases, for whatever reason, that an otherwise illegal
entry gets created that doesn't match the criteria for a valid
user/host/group name. If this happens (i.e. migration) there is no way
to remove this using the IPA tools because we always applied the name
pattern. So you can't, for example, delete a user with an illegal name.

Primary keys are cloned with query=True in PKQuery which causes no
rules to be applied on mod/show/find. This reverts a change from commit
3a5e26a0 which applies class rules when query=True (for enforcing no
white space).

Replace rdnattr with rdn_is_primary_key. This was meant to tell us when
an RDN change was necessary to do a rename. There could be a disconnect
where the rdnattr wasn't the primary key and in that case we don't
need to do an RDN change, so use a boolean instead so that it is
clear that RDN == primary key.

Add a test to ensure that nowhitespace is actually enforced.

https://fedorahosted.org/freeipa/ticket/2115

Related: https://fedorahosted.org/freeipa/ticket/2089

Whitespace tickets:
https://fedorahosted.org/freeipa/ticket/1285
https://fedorahosted.org/freeipa/ticket/1286
https://fedorahosted.org/freeipa/ticket/1287
2012-02-29 18:00:45 -05:00
Martin Kosek
2a3a4ae64a Fix LDAP object parameter encoding
Parameters in LDAP objects missed an information if they are real
LDAP attributes or not. Real LDAP attributes are written to
entry_attrs dictionary in plugin callbacks and are being encoded.
This causes issues when plugin callbacks does not expect that
the parameters values are already encoded for submission to LDAP.

This patch introduces a new flag "noattribute" used to mark that
a parameter is not an LDAP attribute and thus should not be encoded
or added to entry_attrs. Param documentation is improved to describe
the meaning of this and other Param flags or attributes.

https://fedorahosted.org/freeipa/ticket/2097
2011-11-15 13:17:44 +01:00
Martin Kosek
d28f1c3b7c Fix automountkey-mod
Fix automountkey-mod so that automountkey attribute is correctly
updated. Add this test case to the unit tests.

Make automountkey required for automountkey-mod, otherwise it would
cause internal server error.

Make --newinfo optional so that automountkey may be just renamed
without changing its info attribute.

https://fedorahosted.org/freeipa/ticket/1528
2011-08-18 20:35:12 -04:00
Jan Zeleny
6cca48cb59 Add flags to enforce asking for object attribute
So far the only flag to enforce asking in interactive mode was the
alwaysask attribute, which is not sufficient any more. This patch adds
the ability to control for which actions the atrribute shall be asked
for.
2011-01-26 09:29:39 -05:00
Rob Crittenden
c69d8084c1 Add API version and have server reject incompatible clients.
This patch contains 2 parts.

The first part is a small utility to create and validate the current
API. To do this it needs to load ipalib which on a fresh system
introduces a few problems, namely that it relies on a python plugin
to set the default encoding to utf8. For our purposes we can skip that.
It is also important that any optional plugins be loadable so the
API can be examined.

The second part is a version exchange between the client and server.
The version has a major and a minor version. The major verion is
updated whenever existing API changes. The minor version is updated when
new API is added. A request will be rejected if either the major versions
don't match or if the client major version is higher than then server
major version (though by implication new API would return a command not
found if allowed to proceed).

To determine the API version of the server from a client use the ping
command.

ticket 584
2011-01-14 14:26:22 -05:00
Pavel Zuna
1af89d0daa Retype (when cloning) Flag parameters to Bool for search commands.
Flag parameters are always autofill by definition, causing unexpected
search results. This patch retypes them to Bool for search commands,
so that users have to/can enter the desired value manually.

Ticket #689
Ticket #701
2011-01-10 12:07:19 -05:00
Jakub Hrozek
7493d781df Change FreeIPA license to GPLv3+
The changes include:
 * Change license blobs in source files to mention GPLv3+ not GPLv2 only
 * Add GPLv3+ license text
 * Package COPYING not LICENSE as the license blobs (even the old ones)
   mention COPYING specifically, it is also more common, I think

 https://fedorahosted.org/freeipa/ticket/239
2010-12-20 17:19:53 -05:00
Jason Gerard DeRose
47f2e618f9 Fix non XML-RPC tests 2010-02-19 18:10:37 -05:00
Jason Gerard DeRose
c43b69e77c Add support for the 'no_create', 'no_update', and 'no_search' Param flags 2010-02-05 14:32:04 -05:00
Jason Gerard DeRose
b6e4972e7f Take 2: Extensible return values and validation; steps toward a single output_for_cli(); enable more webUI stuff 2009-12-10 08:29:15 -07:00
Rob Crittenden
97dfa586de Make primary_key optional.
The pwpolicy plugin doesn't have a primary key but can still take advantage
of other parts of the framework.
2009-10-05 13:28:24 -06:00
Pavel Zuna
6f37d139cb Remove obsolete CRUD base classes as they aren't used anymore. 2009-09-08 13:43:33 -04:00
Pavel Zuna
8edaff5266 Generate crud.Search arguments with get_args. 2009-06-10 11:53:20 -04:00
Pavel Zuna
a92e440218 Clone options of crud.Update and crud.Search with autofill=False. 2009-05-26 13:36:58 -04:00
Pavel Zuna
016b82250e Add ipalib.frontend.Command method to build an entry from params with attribute=True.
Often plugins need to build LDAP entries from params. This should make things a bit easier.
Crud methods (Create, Retrieve, Update, Delete, Search) have attribute=True by default.
And it also works for multivalue params.
2009-02-23 13:49:21 -05:00
Jason Gerard DeRose
92a150b4f1 Some tweaks in user plugins, ported to new crud base classes 2009-02-03 15:29:05 -05:00
Jason Gerard DeRose
db0168f7af Started reworking CLI class into cli plugin 2009-02-03 15:29:03 -05:00
Jason Gerard DeRose
6aadeb9aea Added Object.params_minus() method; various small tweaks 2009-02-03 15:29:00 -05:00
Jason Gerard DeRose
4febb4dd14 Started roughing out new crud base classes 2009-02-03 15:28:59 -05:00
Jason Gerard DeRose
cd3508bace New Param: added Param.query kwarg for crud operations like Retrieve and Search where criteria should not be validated 2009-01-14 14:04:05 -07:00
Jason Gerard DeRose
79422d0489 All unit tests now working (except for doctests and Rob's xmlrpc tests) 2009-01-14 13:51:37 -07:00
Rob Crittenden
f18c84444d Partially revert back change. Del shouldn't provide default options.
It can provide custom ones though, if defined with takes_params() in the class.
2008-11-03 13:14:46 -05:00
Rob Crittenden
62876ccee3 Initial implementation of automount support
Add argument handling to crud.Del
Make get_list handle LDAP scope
2008-10-30 17:29:22 -04:00
Rob Crittenden
d2b46f176e Use common display function for user-show and user-find.
Add --all option to user-find
Fix command-line help to make sense on searches as well
2008-10-23 14:36:24 -04:00
Rob Crittenden
e7937f2944 Add missing * to *kw to make it pass named arguments instead of positional 2008-10-15 09:57:49 -04:00
Rob Crittenden
cfc8450efd Port user-show to new CrudBackend framework 2008-10-14 22:22:01 -04:00
Jason Gerard DeRose
225e2b0c93 Added CrudBackend abstract class defining generic CRUD API 2008-10-13 09:50:29 -06:00
Jason Gerard DeRose
87390665f6 crud.Add.get_args() and get_options() now yield static values in takes_args, takes_options after the automagic ones 2008-10-09 11:33:35 -06:00
Jason Gerard DeRose
7ee0ccd90d Fixed unit tests; changed example.py so it doesn't import servercore 2008-09-30 20:27:52 -06:00
Rob Crittenden
b965e558b5 Rebase XML-RPC client and server
Fix error handling in server to return exceptions generated in library code
2008-09-30 19:37:35 -06:00
Jason Gerard DeRose
55ba8e9d0b 365: Implemented find.get_args(), find.get_options(); added corresponding unit tests 2008-09-25 03:47:22 +00:00
Jason Gerard DeRose
ddbe3ae934 364: Implemented Mod.get_args, Mod.get_options(); added corresponding unit tests 2008-09-25 03:42:38 +00:00
Jason Gerard DeRose
c303a06a94 362: Implemented Get.get_args() and Del.get_args(); added corresponding unit tests 2008-09-25 03:14:12 +00:00
Jason Gerard DeRose
023f612921 361: Implemented crud.Add.get_options() method; added corresponding unit tests 2008-09-25 02:13:16 +00:00
Jason Gerard DeRose
5479a349a8 346: Added skeleton framework for crud.py module and corresponding test_crud.py module 2008-09-24 20:17:53 +00:00
Jason Gerard DeRose
293b31ac75 60: Remeved depreciated base.py, crud.py; remeved corresponding test_base.py, test_crud.py 2008-08-06 14:30:21 +00:00
Jason Gerard DeRose
48c7da47c7 25: Updated plugin examples, ipa script 2008-07-20 23:43:16 +00:00
Jason Gerard DeRose
9b3e2f5cec 18: Moved base2 stuff into base 2008-07-20 18:10:08 +00:00
Jason Gerard DeRose
700d58ac1e 11: Added submodules needed to triger the plugin loading, etc., so I can start work on the cli demo 2008-07-20 02:03:15 +00:00
Jason Gerard DeRose
7acf12e988 10: Updated base.API to reflect the fact that base.Object is now the new unit of plugin functionality; updated corresponding unit tests 2008-07-20 01:29:59 +00:00
Jason Gerard DeRose
ccd8eb3373 9: Reorganized new work and unit tests based around base.Object being the plugin definining unit 2008-07-19 23:40:23 +00:00
Jason Gerard DeRose
e76160b01d 8: Experimental work on more OO definition of what gets pluged into API.commands 2008-07-19 21:51:07 +00:00