0

Inconsistency with 'Readable If' and 'Writable If'

I wrote a comprehensive user permissions application that validates user permissions based on:

Entity > Location > Permission

 

Using a Global Function, I wrote this:

#{ obtain list of user permissions for entity or building NEW }#;
function permCheckN(ct : text,rid : number,permissionCompare : text) do
    #{
    Global Variables
}#;
    #{
    Entity permission checking variables
}#;
    let obtainUserEntityAccess := (select int_entity_access where 'System User' = thisUserID());
    let allEntityAccessCheck := first(obtainUserEntityAccess.int_is_sys_record = true) and
        first(contains(obtainUserEntityAccess.int_entity_name, "ALL"));
    let thisEntitySearch := first(obtainUserEntityAccess[int_is_sys_record = true or Entity = number(rid)]);
    let entityAccess := if thisEntitySearch != null then
            true
        else
            false
        end;
    let listEntityPerms := thisEntitySearch.int_permissions_list;
    #{
    Building permission checking variables
}#;
    let obtainUserBuildingAccess := (select int_building_access where 'System User' = thisUserID());
    let thisBuildingSearch := first(obtainUserBuildingAccess[int_is_sys_record = true or Building = number(rid)]);
    let buildingAccess := if thisBuildingSearch != null then
            true
        else
            false
        end;
    let listBuildingPerms := thisBuildingSearch.int_permissions_list;
    #{
    Check the user's permission
}#;
    if isAdminMode() then
        true
    else
        switch upper(ct) do
        case "E":
            if entityAccess = true or rid = 0 then
                if contains(listEntityPerms, upper(permissionCompare)) then
                    true
                else
                    false
                end
            end
        case "B":
            if buildingAccess = true or rid = 0 then
                if contains(listBuildingPerms, upper(permissionCompare)) then
                    true
                else
                    false
                end
            end
        default:
            false
        end
    end
end;

Ultimately, the function will return a Boolean true or false if the user has the appropriate permissions. 

I call function:

permCheckN("B", int_building, "Personnel (Read)")

let's assume the returned result is TRUE. If this function is within 'Readable If' for a field and the output is true, the field is visible.

However, if I place the exact formula within 'Writable If', regardless of the output, the field will still be read-only. 

 

I've even tried putting this function within a formula, and then trying

'Formula Field' = true;

but that still does not work. I am quite bummed, because a lot of work gone into this permissions structure, but its practically unusable due to a programming bug (I assume) within Ninox.

 

Doe anyone have any suggestions?

2 replies

null
    • SMoore
    • yesterday
    • Reported - view

    bump.. hoping for input from someone.

    • Fred
    • yesterday
    • Reported - view

    Have you email Ninox support?

    I tried with a Yes/No field in another table and had no issues using just the name or = true or = 1.