Search in sources :

Example 1 with SystemPermissionsService

use of org.ovirt.engine.sdk4.services.SystemPermissionsService in project ovirt-engine-sdk-java by oVirt.

the class AddSystemPermission method main.

public static void main(String[] args) throws Exception {
    // Create the connection to the server:
    Connection connection = connection().url("https://engine40.example.com/ovirt-engine/api").user("admin@internal").password("redhat123").trustStoreFile("truststore.jks").build();
    // Get the reference to the root of the tree of services:
    SystemService systemService = connection.systemService();
    // Get the reference to the service that manages system permissions:
    SystemPermissionsService permissionsService = systemService.permissionsService();
    // Add the "SupeUser" permission to the user with id "123":
    permissionsService.add().permission(permission().role(role().name("SuperUser")).user(user().id("123"))).send();
    // Close the connection to the server:
    connection.close();
}
Also used : SystemService(org.ovirt.engine.sdk4.services.SystemService) SystemPermissionsService(org.ovirt.engine.sdk4.services.SystemPermissionsService) Connection(org.ovirt.engine.sdk4.Connection)

Aggregations

Connection (org.ovirt.engine.sdk4.Connection)1 SystemPermissionsService (org.ovirt.engine.sdk4.services.SystemPermissionsService)1 SystemService (org.ovirt.engine.sdk4.services.SystemService)1