Servoy / svySecurity

All-purpose security module for Servoy
MIT License
0 stars 2 forks source link

Bug function loadProperties #23

Closed juanetec closed 4 years ago

juanetec commented 4 years ago

Hi, I found a bug in the svyProperties.js function loadProperties(propertyKey, propertyType, tenantName, userName)
at the line 779 must be userName.

`function loadProperties(propertyKey, propertyType, tenantName, userName) { var query = datasources.db.svy_security.svy_properties.createSelect(); query.result.addPk();

if (propertyKey) {
    if (propertyKey.indexOf("%") > -1) {
        query.where.add(query.columns.property_namespace.like(propertyKey));
    } else {
        query.where.add(query.columns.property_namespace.eq(propertyKey));
    }
}

if (propertyType) {
    query.where.add(query.columns.property_type.eq(propertyType));
}

if (tenantName !== IGNORE_PARAMETER) {
    if (!tenantName) {
        query.where.add(query.columns.tenant_name.isNull);
    } else {
        query.where.add(query.columns.tenant_name.eq(tenantName));          
    }
}

if (userName !== IGNORE_PARAMETER) {
    if (!userName) {
        query.where.add(query.columns.user_name.isNull);
    } else {
        query.where.add(query.columns.user_name.eq(tenantName));            
    }
}

var fsProperties = datasources.db.svy_security.svy_properties.getFoundSet();
fsProperties.loadRecords(query);
var result = [];

for (var i = 1; i <= fsProperties.getSize(); i++) {
    var record = fsProperties.getRecord(i);
    result.push(new Property(record));
}

return result;

}`

Un Saludo

Juan Ramírez

pruhsert commented 4 years ago

Thanks for reporting. One of the few cases for which we had no test...