summaryrefslogtreecommitdiffstats
path: root/ipalib
diff options
context:
space:
mode:
Diffstat (limited to 'ipalib')
-rw-r--r--ipalib/crud.py6
-rw-r--r--ipalib/plugins/example.py9
2 files changed, 13 insertions, 2 deletions
diff --git a/ipalib/crud.py b/ipalib/crud.py
index 5021d06da..813e0c814 100644
--- a/ipalib/crud.py
+++ b/ipalib/crud.py
@@ -25,8 +25,12 @@ import frontend, errors
class Add(frontend.Method):
+ def get_args(self):
+ yield self.obj.primary_key
+
def get_options(self):
- return self.obj.params()
+ for param in self.obj.params_minus_pk():
+ yield param.__clone__(required=False)
class Get(frontend.Method):
diff --git a/ipalib/plugins/example.py b/ipalib/plugins/example.py
index c565d6785..c7d161600 100644
--- a/ipalib/plugins/example.py
+++ b/ipalib/plugins/example.py
@@ -26,7 +26,8 @@ from ipalib import frontend
from ipalib import crud
from ipalib.frontend import Param
from ipalib import api
-
+from ipalib import servercore
+import ldap
class user(frontend.Object):
'User object'
@@ -78,6 +79,8 @@ api.register(envtest)
# Register some methods for the 'user' object:
class user_add(crud.Add):
'Add a new user.'
+ def execute(self, *args, **kw):
+ return 1
api.register(user_add)
class user_del(crud.Del):
@@ -90,6 +93,10 @@ api.register(user_mod)
class user_find(crud.Find):
'Search the users.'
+ def execute(self, *args, **kw):
+ uid=args[0]
+ result = servercore.get_sub_entry(servercore.basedn, "uid=%s" % uid, ["*"])
+ return result
api.register(user_find)
class user_show(crud.Get):