Hi Ondra,

We are not using ovirtSDK, It is completely new to us. 

Is there an oVirt API 
       1) To discover all the users in LDAP using the provided domain and namespace?
       2) Add all the discovered users in Ovirt?
       3) Assign the superuser permission for all the discovered users?

Thanks,
Hari

On Tue, Jul 24, 2018 at 3:26 PM, Ondra Machacek <omachace@redhat.com> wrote:
Something like this should work for you:

import ovirtsdk4 as sdk
import ovirtsdk4.types as types

DOMAIN_NAME = 'internal-authz'

connection = sdk.Connection(...)

users_service = connection.system_service().users_service()

domains_service = connection.system_service().domains_service()
domain = next((domain for domain in domains_service.list() if domain.name == DOMAIN_NAME), None)
domain_service = domains_service.domain_service(domain.id)
users = domain_service.users_service().list()
for user in users:
    users_service.add(
        types.User(
            user_name=user.user_name,
            domain=types.Domain(
                name=domain.name,
            ),
        ),
    )

connection.close()


On 07/24/2018 11:51 AM, Hari Prasanth Loganathan wrote:
Also Ondra,

I added the list of users in a group in LDAP and I am able to discover all the users in ovirt UI (In add users and groups tab).
*Is there an API *to discover the users in LDAP and add in the user's table in Ovirt?

Thanks,
Hari

On Tue, Jul 24, 2018 at 2:53 PM, Hari Prasanth Loganathan <hariprasanth.l@msystechnologies.com <mailto:hariprasanth.l@msystechnologies.com>> wrote:

    Hi Ondra,

    Thanks much for the suggestion. Much Appreciated.

    It's not, but you can write a script which can do this. - Could you
    give a small brief on the type of script we need to write?



    On Tue, Jul 24, 2018 at 12:50 PM, Ondra Machacek
    <omachace@redhat.com <mailto:omachace@redhat.com>> wrote:

        It's not, but you can write a script which can do this. But if
        you want
        all users from the ldap are able to login I would suggest to you
        create
        some group in LDAP and add all users as a member of this group
        and add
        this group to ovirt and assign it the permissions.

        On 07/23/2018 08:36 PM, Hari Prasanth Loganathan wrote:

            Guys any update on this ?

            Any help is much useful for me 😊

            On Mon, 23 Jul 2018 at 9:04 PM, Hari Prasanth Loganathan
            <hariprasanth.l@msystechnologies.com
            <mailto:hariprasanth.l@msystechnologies.com>
            <mailto:hariprasanth.l@msystechnologies.com

            <mailto:hariprasanth.l@msystechnologies.com>>> wrote:

                 Hi Team,

                 Good Morning.

                 I configured the ovirt with LDAP setup.

                 Is there an *oVirt tool* (or any way) to add all the
            users from LDAP
                 to Ovirt?

                 _*Observation*_ :

                 1) I am able to see that when I try to login with the
            user from
                 LDAP, that user is added in Ovirt database, So Is there
            a way to
                 sync all the users from LDAP to Ovirt using any oVirt
            tool or API?

                 Any help is much appreciated.

                 Thanks,
                 Hari


            DISCLAIMER- *MSysTechnologies LLC*

            This email message, contents and its attachments may contain
            confidential, proprietary or legally privileged information
            and is intended solely for the use of the individual or
            entity to whom it is actually intended. If you have
            erroneously received this message, please permanently delete
            it immediately and notify the sender. If you are not the
            intended recipient of the email message,you are notified
            strictly not to disseminate,distribute or copy this
            e-mail.E-mail transmission cannot be guaranteed to be secure
            or error-free as Information could be intercepted,
            corrupted, lost, destroyed, incomplete or contain viruses
            and MSysTechnologies LLC accepts no liability for the
            contents and integrity of this mail or for any damage caused
            by the limitations of the e-mail transmission.



            _______________________________________________
            Users mailing list -- users@ovirt.org <mailto:users@ovirt.org>
            To unsubscribe send an email to users-leave@ovirt.org
            <mailto:users-leave@ovirt.org>
            Privacy Statement:
            https://www.ovirt.org/site/privacy-policy/
            <https://www.ovirt.org/site/privacy-policy/>
            oVirt Code of Conduct:
            https://www.ovirt.org/community/about/community-guidelines/
            <https://www.ovirt.org/community/about/community-guidelines/>
            List Archives:
            https://lists.ovirt.org/archives/list/users@ovirt.org/message/TNDRY46K7PYM2TCIHR3IHUL2B6LPV2QC/
            <https://lists.ovirt.org/archives/list/users@ovirt.org/message/TNDRY46K7PYM2TCIHR3IHUL2B6LPV2QC/>




DISCLAIMER- *MSysTechnologies LLC*

This email message, contents and its attachments may contain confidential, proprietary or legally privileged information and is intended solely for the use of the individual or entity to whom it is actually intended. If you have erroneously received this message, please permanently delete it immediately and notify the sender. If you are not the intended recipient of the email message,you are notified strictly not to disseminate,distribute or copy this e-mail.E-mail transmission cannot be guaranteed to be secure or error-free as Information could be intercepted, corrupted, lost, destroyed, incomplete or contain viruses and MSysTechnologies LLC accepts no liability for the contents and integrity of this mail or for any damage caused by the limitations of the e-mail transmission.



DISCLAIMER - MSysTechnologies LLC

This email message, contents and its attachments may contain confidential, proprietary or legally privileged information and is intended solely for the use of the individual or entity to whom it is actually intended. If you have erroneously received this message, please permanently delete it immediately and notify the sender. If you are not the intended recipient of the email message,you are notified strictly not to disseminate,distribute or copy this e-mail.E-mail transmission cannot be guaranteed to be secure or error-free as Information could be intercepted, corrupted, lost, destroyed, incomplete or contain viruses and MSysTechnologies LLC accepts no liability for the contents and integrity of this mail or for any damage caused by the limitations of the e-mail transmission.