canAccessSchemaEntity

canAccessSchemaEntity(schemaEntity: SchemaEntity;
                      errorMessage: String output): Boolean;

The canAccessSchemaEntity method of the JadeMetadataAnalyzer class checks the access to each schema entity (class, method, property, and so on) referenced in the method being validated. The schema entity object is specified in the schemaEntity parameter.

This method returns true if the access is allowed or it returns false if the access is not allowed. If the access is not allowed, an error message may be returned in the errorMessage parameter and this message is then returned in the accessErrorMessage parameter of the validateMethod method. The canAccessSchemaEntity method returns true by default.

To implement user-defined access checking of schema entities, reimplement this method in a user subclass of the JadeMetadataAnalyzer class.

The following example checks that input method source code does not reference the Employee class or the deposit method of the Account class.

canAccessSchemaEntity(se: SchemaEntity; err: String output): Boolean;
begin
    if se.isKindOf(Class) then
        if se.name = 'Employee' then
            err := 'access to class is not allowed';
            return false;
        endif;
    elseif se.isKindOf(Method) then
        if se.Method.schemaType.name = 'Account' and se.name = 'deposit' then
            err := 'access to method is not allowed';
            return false;
        endif;
    endif;
    return true;
end;