summaryrefslogtreecommitdiffstats
path: root/src/account
diff options
context:
space:
mode:
authorRoman Rakus <rrakus@redhat.com>2013-10-03 14:06:08 +0200
committerRoman Rakus <rrakus@redhat.com>2013-10-03 14:29:06 +0200
commit7abb8f2d324dc6dfecaa1acf571616342650c675 (patch)
tree7a29df65176c518e4ca1e1164a540b0a06b70933 /src/account
parent0f65a7e820f303eff1a5102e135fac7d623ec492 (diff)
downloadopenlmi-providers-7abb8f2d324dc6dfecaa1acf571616342650c675.tar.gz
openlmi-providers-7abb8f2d324dc6dfecaa1acf571616342650c675.tar.xz
openlmi-providers-7abb8f2d324dc6dfecaa1acf571616342650c675.zip
Account: Documentation improvement
Use dict parameter in first_instance method Signed-off-by: Roman Rakus <rrakus@redhat.com>
Diffstat (limited to 'src/account')
-rw-r--r--src/account/doc/source/usage.rst24
1 files changed, 12 insertions, 12 deletions
diff --git a/src/account/doc/source/usage.rst b/src/account/doc/source/usage.rst
index 708c42c..7a2638a 100644
--- a/src/account/doc/source/usage.rst
+++ b/src/account/doc/source/usage.rst
@@ -27,9 +27,9 @@ of this class represents one user on the system. Both system and non-sytem users
are directly in :ref:`LMI_Account <LMI-Account>` class::
# List user by name
- print c.root.cimv2.LMI_Account.first_instance(key="name", value="root")
+ print c.root.cimv2.LMI_Account.first_instance({"Name": "root"})
# List user by id
- print c.root.cimv2.LMI_Account.first_instance(key="UserID", value="0")
+ print c.root.cimv2.LMI_Account.first_instance({"UserID": "0"})
List groups
@@ -38,9 +38,9 @@ Similarly like users, groups are represented by objects
of :ref:`LMI_Group <LMI-Group>` class::
# List group by name
- print c.root.cimv2.LMI_Group.first_instance(key="Name", value="root")
+ print c.root.cimv2.LMI_Group.first_instance({"Name": "root"})
# List group by id
- print c.root.cimv2.LMI_Group.first_instance(key="InstanceID", value="LMI:GID:0")
+ print c.root.cimv2.LMI_Group.first_instance({"InstanceID": "LMI:GID:0"})
List group members
@@ -55,7 +55,7 @@ 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(key="Name", value="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")
# 3) go through all identites, get LMI_Account associated with identity and print user name
@@ -99,7 +99,7 @@ method on the desired :ref:`LMI_Account <LMI-Account>` object.
::
# get the desired user
- acci = c.root.cimv2.LMI_Account.first_instance(key="Name", value="tobedeleted")
+ acci = c.root.cimv2.LMI_Account.first_instance({"Name": "tobedeleted"})
# delete the user
acci.DeleteUser()
@@ -120,7 +120,7 @@ method on the desired :ref:`LMI_Group <LMI-Group>` object,
::
# get the desired group
- grp = c.root.cimv2.LMI_Group.first_instance(key="Name", value="tobedeleted")
+ grp = c.root.cimv2.LMI_Group.first_instance({"Name": "tobedeleted"})
# delete the group
grp.DeleteGroup()
@@ -140,9 +140,9 @@ 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(key="Name", value="pegasus")
+ grp = c.root.cimv2.LMI_Group.first_instance({"Name": "pegasus"})
# get user root
- acc = c.root.cimv2.LMI_Account.first_instance(key="Name", value="root")
+ acc = c.root.cimv2.LMI_Account.first_instance({"Name": "root"})
# get identity of root user
identity = acc.first_associator(ResultClass="LMI_Identity")
# create instance of LMI_MemberOfGroup with the above references
@@ -155,9 +155,9 @@ 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(key="Name", value="pegasus")
+ grp = c.root.cimv2.LMI_Group.first_instance({"Name": "pegasus"})
# get user root
- acc = c.root.cimv2.LMI_Account.first_instance(key="Name", value="root")
+ acc = c.root.cimv2.LMI_Account.first_instance({"Name": "root"})
# get identity of root user
identity = acc.associators(ResultClass="LMI_Identity")[0]
# iterate through all LMI_MemberOfGroup associated with identity and remove the one with our group
@@ -171,7 +171,7 @@ It is also possible to modify user details and it is done by ``ModifyInstance``
intrinsic method on the desired :ref:`LMI_Account <LMI-Account>` object::
# Change login shell of test user
- acci = c.root.cimv2.LMI_Account.first_instance(key="Name", value="test")
+ acci = c.root.cimv2.LMI_Account.first_instance({"Name": "test"})
acci.LoginShell = '/bin/sh'
# propagate changes
acci.push()