forked from chef-boneyard/private-chef-administration
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Fixing syntax highlighting, adding org_mapper and support
- Loading branch information
Showing
8 changed files
with
473 additions
and
63 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,98 @@ | ||
========= | ||
orgmapper | ||
========= | ||
|
||
.. warning:: | ||
|
||
**orgmapper** is not currently supported by default by Private Chef. It will be fully enabled in a future release - the documentation is included for your reference should an Opscode Support Engineer assist you in enabling it on your existing Private Chef infrastructure. | ||
|
||
:command:`orgmapper` is a tool based on :command:`irb` (the ruby REPL) which provides | ||
administrative access to the many of the back-end objects in Private Chef. | ||
|
||
Starting orgmapper | ||
------------------ | ||
|
||
Login to the server that is your Private Chef backend. (In an HA configuration, this should be the current HA primary.) | ||
|
||
.. code-block:: bash | ||
$ /opt/opscode/bin/orgmapper /etc/opscode/orgmapper.conf | ||
You can then query organizations, users, etc through methods like: | ||
|
||
.. code-block:: ruby | ||
orgmapper:0 > pp ORGS.all | ||
orgmapper:0 > pp ORGS['ORGNAME'] | ||
orgmapper:0 > pp USERS.all | ||
orgmapper:0 > pp USERS['USER'] | ||
Where ``ORGNAME`` is an organization short name, and ``USER`` is a username. | ||
|
||
|
||
Determine the Users in an Organization | ||
-------------------------------------- | ||
|
||
.. code-block:: ruby | ||
orgmapper:0 > OrganizationUser.users_for_organization(ORGS['ORGNAME']).collect do |orguser| | ||
Mixlib::Authorization::Models::User.get(orguser)["username"] | ||
end | ||
Replace ``ORGNAME`` with the organization's short name. | ||
|
||
Determine the Organizations for a User | ||
-------------------------------------- | ||
.. code-block:: ruby | ||
orgmapper:0 > OrganizationUser.organizations_for_user(USERS['USERNAME']).collect do |orguser| | ||
Mixlib::Authorization::Models::Organization.get(orguser)["name"] | ||
end | ||
Replace ``USERNAME`` with the username. | ||
|
||
Determine a Username based on an Email Address | ||
---------------------------------------------- | ||
.. code-block:: ruby | ||
orgmapper:0 > USERS.select{|u| u['email'] == '[email protected]'} | ||
Replace ``[email protected]`` with the email address. | ||
|
||
Associate a User to an Organization | ||
----------------------------------- | ||
|
||
Make sure the user and the organization both exist, then: | ||
|
||
.. code-block:: ruby | ||
orgmapper:0 > OrgMapper::Associator.associate_user(ORGS['ORGNAME'], USERS['USERNAME']) | ||
Replace ``ORGNAME`` with the organization, and ``USERNAME`` with the username you want to associate. | ||
|
||
Add a User to an Organization's Admins Group | ||
-------------------------------------------- | ||
|
||
.. code-block:: ruby | ||
orgmapper:0> ORGS['ORGNAME'].add_user_to_group('USERNAME', 'admins') | ||
Replace ``ORGNAME`` with the organization, and ``USERNAME`` with the username. | ||
|
||
Remove a User to an Organization's Admins Group | ||
----------------------------------------------- | ||
|
||
.. code-block:: ruby | ||
orgmapper:0> ORGS['ORGNAME'].remove_user_from_group('USERNAME', 'admins') | ||
Delete a User | ||
------------- | ||
|
||
.. code-block:: ruby | ||
orgmapper:0 > USERS['USERNAME'] | ||
orgmapper:0 > USERS['USERNAME'].destroy | ||
Replace ``USERNAME`` with the username you want to delete. | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.