summaryrefslogtreecommitdiffstats
path: root/doc
diff options
context:
space:
mode:
authorMichal Minar <miminar@redhat.com>2013-11-07 09:59:54 +0100
committerMichal Minar <miminar@redhat.com>2013-11-07 10:01:18 +0100
commitf6eebf97deb102abc1315087fa6d17e3b91a8898 (patch)
tree7611e12e39f422e8cb6e2fc9006d36259847eebc /doc
parente3ecdbe5e20c68556b824a03aec5a709bd654d45 (diff)
downloadopenlmi-providers-f6eebf97deb102abc1315087fa6d17e3b91a8898.tar.gz
openlmi-providers-f6eebf97deb102abc1315087fa6d17e3b91a8898.tar.xz
openlmi-providers-f6eebf97deb102abc1315087fa6d17e3b91a8898.zip
account: updated documentation
Fixed examples for account provider. Some were syntactically wrong, others were very inefficient.
Diffstat (limited to 'doc')
-rw-r--r--doc/admin/account/usage.rst28
1 files changed, 19 insertions, 9 deletions
diff --git a/doc/admin/account/usage.rst b/doc/admin/account/usage.rst
index 6d55851..9a28cd5 100644
--- a/doc/admin/account/usage.rst
+++ b/doc/admin/account/usage.rst
@@ -20,6 +20,9 @@ from following classes:
Some common use cases are described in the following parts
+.. note::
+ Examples are written for ``lmishell`` version ``0.9``.
+
List users
----------
List of users are provided by :ref:`LMI_Account <LMI-Account>`. Each one object
@@ -55,13 +58,16 @@ by :ref:`LMI_AssignedAccountIdentity <LMI-AssignedAccountIdentity>` with
# Get users from root group
# 1) Get root group object
- root_group = c.root.cimv2.LMI_Group.first_instance({"Name": "root")
+ root_group = c.root.cimv2.LMI_Group.first_instance({"Name": "root"})
# 2) Get LMI_Identity objects associated with root group
- identities = root_group.associators(ResultClass="LMI_Identity", AssocClass="LMI_MemberOfGroup")
+ identities = root_group.associators(
+ AssocClass="LMI_MemberOfGroup", ResultClass="LMI_Identity")
# 3) go through all identites, get LMI_Account associated with identity and print user name
# Note: associators returns a list, but there is just one LMI_Account
for i in identities:
- print i.first_associator(ResultClass="LMI_Account").Name
+ print i.first_associator(
+ AssocClass="LMI_AssignedAccountIdentity",
+ ResultClass="LMI_Account").Name
Create user
-----------
@@ -140,13 +146,15 @@ to :ref:`LMI_Group <LMI-Group>` and :ref:`LMI_Identity <LMI-Identity>`::
# We will add root user to pegasus group
# get group pegasus
- grp = c.root.cimv2.LMI_Group.first_instance({"Name": "pegasus"})
+ grp = c.root.cimv2.LMI_Group.first_instance_name({"Name": "pegasus"})
# get user root
acc = c.root.cimv2.LMI_Account.first_instance({"Name": "root"})
# get identity of root user
- identity = acc.first_associator(ResultClass="LMI_Identity")
+ identity = acc.first_associator_name(
+ AssocClass='LMI_AssignedAccountIdentity',
+ ResultClass="LMI_Identity")
# create instance of LMI_MemberOfGroup with the above references
- c.root.cimv2.LMI_MemberOfGroup.create_instance({"Member":identity.path, "Collection":grp.path})
+ c.root.cimv2.LMI_MemberOfGroup.create_instance({"Member":identity, "Collection":grp})
Remove user from group
----------------------
@@ -155,14 +163,16 @@ on the desired :ref:`LMI_MemberOfGroup <LMI-MemberOfGroup>` object::
# We will remove root user from pegasus group
# get group pegasus
- grp = c.root.cimv2.LMI_Group.first_instance({"Name": "pegasus"})
+ grp = c.root.cimv2.LMI_Group.first_instance_name({"Name": "pegasus"})
# get user root
acc = c.root.cimv2.LMI_Account.first_instance({"Name": "root"})
# get identity of root user
- identity = acc.associators(ResultClass="LMI_Identity")[0]
+ identity = acc.first_associator(
+ AssocClass="LMI_AssignedAccountIdentity",
+ ResultClass="LMI_Identity")
# iterate through all LMI_MemberOfGroup associated with identity and remove the one with our group
for mog in identity.references(ResultClass="LMI_MemberOfGroup"):
- if mog.Collection == grp.path:
+ if mog.Collection == grp:
mog.delete()
Modify user