Search in sources :

Example 6 with AbstractMetadataRecord

use of org.teiid.metadata.AbstractMetadataRecord in project teiid by teiid.

the class DefaultAuthorizationValidator method isAccessible.

@Override
public boolean isAccessible(AbstractMetadataRecord record, CommandContext commandContext) {
    if (policyDecider == null || !policyDecider.validateCommand(commandContext) || // TODO - schemas cannot be hidden - unless we traverse them and find that nothing is accessible
    record instanceof Schema) {
        return true;
    }
    AbstractMetadataRecord parent = record;
    while (parent.getParent() != null) {
        parent = parent.getParent();
        if (parent instanceof Procedure) {
            // don't check procedure params/rs columns
            return true;
        }
    }
    if (!(parent instanceof Schema) || (CoreConstants.SYSTEM_MODEL.equalsIgnoreCase(parent.getName()) || CoreConstants.ODBC_MODEL.equalsIgnoreCase(parent.getName()))) {
        // access is always allowed to system tables / procedures or unrooted objects
        return true;
    }
    PermissionType action = PermissionType.READ;
    if (record instanceof FunctionMethod || record instanceof Procedure) {
        action = PermissionType.EXECUTE;
    }
    // cache permission check
    Boolean result = commandContext.isAccessible(record);
    if (result != null) {
        return result;
    }
    HashSet<String> resources = new HashSet<String>(2);
    resources.add(record.getFullName());
    result = this.policyDecider.getInaccessibleResources(action, resources, Context.METADATA, commandContext).isEmpty();
    commandContext.setAccessible(record, result);
    return result;
}
Also used : PermissionType(org.teiid.adminapi.DataPolicy.PermissionType) Schema(org.teiid.metadata.Schema) Procedure(org.teiid.metadata.Procedure) FunctionMethod(org.teiid.metadata.FunctionMethod) AbstractMetadataRecord(org.teiid.metadata.AbstractMetadataRecord) HashSet(java.util.HashSet)

Example 7 with AbstractMetadataRecord

use of org.teiid.metadata.AbstractMetadataRecord in project teiid by teiid.

the class MongoDBSelectVisitor method getColumnName.

public String getColumnName(ColumnReference obj) {
    String elemShortName = null;
    AbstractMetadataRecord elementID = obj.getMetadataObject();
    if (elementID != null) {
        elemShortName = getRecordName(elementID);
    } else {
        elemShortName = obj.getName();
    }
    return elemShortName;
}
Also used : AbstractMetadataRecord(org.teiid.metadata.AbstractMetadataRecord)

Example 8 with AbstractMetadataRecord

use of org.teiid.metadata.AbstractMetadataRecord in project teiid by teiid.

the class SolrSQLHierarchyVistor method getColumnName.

public static String getColumnName(ColumnReference obj) {
    String elemShortName = null;
    AbstractMetadataRecord elementID = obj.getMetadataObject();
    if (elementID != null) {
        elemShortName = getRecordName(elementID);
    } else {
        elemShortName = obj.getName();
    }
    return elemShortName;
}
Also used : AbstractMetadataRecord(org.teiid.metadata.AbstractMetadataRecord)

Example 9 with AbstractMetadataRecord

use of org.teiid.metadata.AbstractMetadataRecord in project teiid by teiid.

the class OracleExecutionFactory method isDual.

private boolean isDual(NamedTable table) {
    String groupName = null;
    AbstractMetadataRecord groupID = table.getMetadataObject();
    if (groupID != null) {
        groupName = SQLStringVisitor.getRecordName(groupID);
    } else {
        groupName = table.getName();
    }
    return DUAL.equalsIgnoreCase(groupName);
}
Also used : AbstractMetadataRecord(org.teiid.metadata.AbstractMetadataRecord)

Example 10 with AbstractMetadataRecord

use of org.teiid.metadata.AbstractMetadataRecord in project teiid by teiid.

the class EventDistributorImpl method setProperty.

@Override
public void setProperty(String vdbName, String vdbVersion, String uuid, String name, String value) {
    VDBMetaData vdb = getVdbRepository().getLiveVDB(vdbName, vdbVersion);
    if (vdb == null) {
        return;
    }
    TransformationMetadata tm = vdb.getAttachment(TransformationMetadata.class);
    if (tm == null) {
        return;
    }
    AbstractMetadataRecord record = DataTierManagerImpl.getByUuid(tm.getMetadataStore(), uuid);
    if (record != null) {
        DdlPlan.setProperty(vdb, record, name, value);
    }
}
Also used : TransformationMetadata(org.teiid.query.metadata.TransformationMetadata) VDBMetaData(org.teiid.adminapi.impl.VDBMetaData) AbstractMetadataRecord(org.teiid.metadata.AbstractMetadataRecord)

Aggregations

AbstractMetadataRecord (org.teiid.metadata.AbstractMetadataRecord)16 NamedTable (org.teiid.language.NamedTable)3 SQLStringVisitor (org.teiid.language.visitor.SQLStringVisitor)3 Column (org.teiid.metadata.Column)3 List (java.util.List)2 Properties (java.util.Properties)2 DocumentFilter (org.teiid.infinispan.api.DocumentFilter)2 ColumnReference (org.teiid.language.ColumnReference)2 Select (org.teiid.language.Select)2 Table (org.teiid.metadata.Table)2 SObject (com.sforce.soap.partner.sobject.SObject)1 XmlObject (com.sforce.ws.bind.XmlObject)1 ArrayList (java.util.ArrayList)1 HashSet (java.util.HashSet)1 IteratorSetting (org.apache.accumulo.core.client.IteratorSetting)1 Test (org.junit.Test)1 PermissionType (org.teiid.adminapi.DataPolicy.PermissionType)1 VDBMetaData (org.teiid.adminapi.impl.VDBMetaData)1 QueryValidatorException (org.teiid.api.exception.query.QueryValidatorException)1 Cachable (org.teiid.cache.Cachable)1