Search in sources :

Example 1 with ExtUUID

use of org.ovirt.engine.api.extensions.ExtUUID in project ovirt-engine by oVirt.

the class InternalAuthz method invoke.

@Override
public void invoke(ExtMap input, ExtMap output) {
    try {
        ExtUUID command = input.get(Base.InvokeKeys.COMMAND);
        if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.LOAD)) {
            doLoad(input);
        } else if (input.get(Base.InvokeKeys.COMMAND).equals(Base.InvokeCommands.INITIALIZE)) {
        // Do nothing
        } else if (command.equals(Authz.InvokeCommands.FETCH_PRINCIPAL_RECORD)) {
            doFetchPrincipalRecord(input, output);
        } else if (command.equals(Authz.InvokeCommands.QUERY_CLOSE)) {
        // Do nothing
        } else if (command.equals(Authz.InvokeCommands.QUERY_OPEN)) {
            doQueryOpen(input, output);
        } else if (command.equals(Authz.InvokeCommands.QUERY_EXECUTE)) {
            doQueryExecute(input, output);
        } else {
            output.put(Base.InvokeKeys.RESULT, Base.InvokeResult.UNSUPPORTED);
        }
        output.putIfAbsent(Authz.InvokeKeys.STATUS, Authz.Status.SUCCESS);
        output.putIfAbsent(Base.InvokeKeys.RESULT, Base.InvokeResult.SUCCESS);
    } catch (Exception ex) {
        output.mput(Base.InvokeKeys.RESULT, Base.InvokeResult.FAILED).mput(Base.InvokeKeys.MESSAGE, ex.getMessage());
    }
}
Also used : ExtUUID(org.ovirt.engine.api.extensions.ExtUUID)

Example 2 with ExtUUID

use of org.ovirt.engine.api.extensions.ExtUUID in project ovirt-engine by oVirt.

the class SearchParsingUtils method generateQueryMap.

public static ExtMap generateQueryMap(Collection<String> ids, ExtUUID queryEntity) {
    ExtMap result = new ExtMap().mput(Authz.InvokeKeys.QUERY_ENTITY, queryEntity);
    ExtKey key = queryEntity.equals(Authz.QueryEntity.GROUP) ? Authz.GroupRecord.ID : Authz.PrincipalRecord.ID;
    List<ExtMap> filter = ids.stream().map((id) -> createMapForKeyAndValue(key, id)).collect(Collectors.toList());
    result.mput(QueryFilterRecord.OPERATOR, QueryFilterOperator.OR).mput(QueryFilterRecord.FILTER, filter);
    return result;
}
Also used : ExtKey(org.ovirt.engine.api.extensions.ExtKey) Arrays(java.util.Arrays) ExtUUID(org.ovirt.engine.api.extensions.ExtUUID) Authz(org.ovirt.engine.api.extensions.aaa.Authz) ExtMap(org.ovirt.engine.api.extensions.ExtMap) Collection(java.util.Collection) HashMap(java.util.HashMap) Collectors(java.util.stream.Collectors) ArrayList(java.util.ArrayList) List(java.util.List) QueryFilterRecord(org.ovirt.engine.api.extensions.aaa.Authz.QueryFilterRecord) Map(java.util.Map) QueryFilterOperator(org.ovirt.engine.api.extensions.aaa.Authz.QueryFilterOperator) ExtKey(org.ovirt.engine.api.extensions.ExtKey) ExtMap(org.ovirt.engine.api.extensions.ExtMap)

Aggregations

ExtUUID (org.ovirt.engine.api.extensions.ExtUUID)2 ArrayList (java.util.ArrayList)1 Arrays (java.util.Arrays)1 Collection (java.util.Collection)1 HashMap (java.util.HashMap)1 List (java.util.List)1 Map (java.util.Map)1 Collectors (java.util.stream.Collectors)1 ExtKey (org.ovirt.engine.api.extensions.ExtKey)1 ExtMap (org.ovirt.engine.api.extensions.ExtMap)1 Authz (org.ovirt.engine.api.extensions.aaa.Authz)1 QueryFilterOperator (org.ovirt.engine.api.extensions.aaa.Authz.QueryFilterOperator)1 QueryFilterRecord (org.ovirt.engine.api.extensions.aaa.Authz.QueryFilterRecord)1