==============================
Managing System Administrators
==============================

Data Science & AI Workbench distinguishes between System Administrators responsible for authorizing Workbench platform *users*, and System Administrators responsible for managing Workbench *resources*. This enables enterprises to grant the permissions required for configuring each to different individuals, based on their area of responsibility within the organization.  

* System Administrators who are granted permission to access the **Authentication Center** can :doc:`configure authentication for all platform users <../index>`, including platform Admins. See :doc:`managing users <users>` for information on how to create and manage Authentication Center Admins. 

* System Administrators who are granted permission to access the **Operations Center** can :doc:`manage Workbench resources <../resources/index>` and :doc:`configure advanced platform settings <../advanced/settings>`.

.. note::
   The login credentials for the Operations Center are initially set as part of the :doc:`post-install configuration process <../../install/config>`. Follow the steps outlined below to authorize additional Admin users to manage cluster resources, :ref:`using the Operations Center UI <ui-steps>` or :ref:`using a command line <cli-steps>`. If you prefer to use OpenID Connect (OIDC), see :doc:`oidc`. 

--------------

.. _ui-steps:

Managing Operations Center Admins using the UI
==============================================

#. Open the |circle-user| **My Account** dropdown menu and select *Admin Console*.
#. Select |link-out| **Manage Users** to access the Keycloak user interface (UI). 
#. Log in using your Keycloak admin account credentials.
#. Select **Settings** in the login menu in the upper-right corner.
#. Select **Users** from the left-hand navigation.
#. Click **+ New User** in the upper-right corner.
#. Select ``@teleadmin`` from the **Roles** drop-down list, and click **Create invite link**.

   .. thumbnail:: ../../images/new-telekube-user.png
      :align: center

#. Copy the invitation URL that is generated, replace the private IP address with the fully-qualified domain name of the host, if necessary, and send it to the individual using your preferred method of secure communication. They'll use it to set their password, and will be automatically logged in to the Operations Center when they click **Continue**.

To generate a new invitation URL, select **Renew invitation** in the **Actions** menu for the user. 

.. thumbnail:: ../../images/telekube-invitation.png
   :align: center

Select **Revoke invitation** to prevent them from being able to use the invitation to create a password and access the Operations Center. This effectively deletes the user before they have a chance to set their credentials.
   
To delete---or otherwise manage---an Operations Center user after they have set their credentials and completed the authorization process, select the appropriate option from the **Actions** menu.

.. thumbnail:: ../../images/existing-telekube-user.png
   :align: center

--------------

.. _cli-steps:

Managing Operations Center Admins using a command line
======================================================

**To create a new Admin:**

Run the following commands *on the Workbench master node*, replacing ``<email>`` and ``<yourpass>`` with the email address and password for the user::

   sudo gravity enter
   gravity --insecure user create --type=admin --email=<email> --password=<yourpass> --ops-url=https://gravity-site.kube-system.svc.cluster.local:3009  

To verify that the user was created, run the following command::

   sudo gravity resource get users

**To update an Admin user's password:**

To update an Admin user's password, you'll need to delete the user account, then re-create it, replacing ``<email>`` and ``<yourpass>`` with the email address and new password::

   sudo gravity enter
   gravity --insecure user delete --email=<email> --ops-url=https://gravity-site.kube-system.svc.cluster.local:3009
   gravity --insecure user create --type=admin --email=<email> --password=<yourpass> --ops-url=https://gravity-site.kube-system.svc.cluster.local:3009 


.. |circle-user| raw:: html
   
   <svg height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M256 496c-54 0-103.9-17.9-144-48v0c0-61.9 50.1-112 112-112h64c61.9 0 112 50.1 112 112v0c5.3-4 10.4-8.2 15.4-12.6C409.1 370.6 354.5 320 288 320H224c-66.5 0-121.1 50.6-127.4 115.4C47.2 391.5 16 327.4 16 256C16 123.5 123.5 16 256 16s240 107.5 240 240s-107.5 240-240 240zm0 16A256 256 0 1 0 256 0a256 256 0 1 0 0 512zm80-304a80 80 0 1 0 -160 0 80 80 0 1 0 160 0zm-80-64a64 64 0 1 1 0 128 64 64 0 1 1 0-128z"/></svg>

.. |link-out| raw:: html

    <svg height="1em" width="1em" xmlns="http://www.w3.org/2000/svg" viewBox="0 0 512 512"><path d="M320 33c0-18.2 14.8-33 33-33H480c17.7 0 32 14.3 32 32V159c0 18.2-14.8 33-33 33c-8.7 0-17.1-3.5-23.3-9.7L404 130.6 235.3 299.3c-6.2 6.2-16.4 6.2-22.6 0s-6.2-16.4 0-22.6L381.4 108 329.7 56.3C323.5 50.1 320 41.7 320 33zm33-1c-.5 0-1 .4-1 1c0 .3 .1 .5 .3 .7L478.3 159.7c.2 .2 .4 .3 .7 .3c.5 0 1-.4 1-1V32H353zM0 96C0 60.7 28.7 32 64 32H208c8.8 0 16 7.2 16 16s-7.2 16-16 16H64C46.3 64 32 78.3 32 96V448c0 17.7 14.3 32 32 32H416c17.7 0 32-14.3 32-32V304c0-8.8 7.2-16 16-16s16 7.2 16 16V448c0 35.3-28.7 64-64 64H64c-35.3 0-64-28.7-64-64V96z"/></svg>