0

Global Variable - Permissions (possible bug?)

Hi community,

I have a global variable that is used to check field permissions. 

It is:

function permCheck(permission : text) do
    let currentUser := first(select 'System User' where int_linked_user = user() or Email = userEmail()).Id;
    let newPerm := upper(record('System User',currentUser).int_permissions_list);
    if contains(newPerm, upper(permission)) then
        true
    else
        false
    end
end;

For some reason, in Readable if for a table, if I have:

permCheck("System Users (Read)")

And the user has that permission, I can view the table. 

However, using the same permCheck() in Writable if, it does not work. The same applies for field Writable if.

 

Does anyone have any suggestions? If you would like to see my template to aide troubleshooting, I can email it to you.

 

Thank you,

 

SIDE NOTE: The result of newPerm within the function is (int_permissions_list): "SYSTEM USERS (MODIFY), SYSTEM USERS (READ), SYSTEM USERS (DELETE/ENABLE/DISABLE), APPLICATION ACCESS - ACCOUNT ENABLED, USER GROUP (READ), USER GROUP (MODIFY), USER GROUP (DELETE/ENABLE/DISABLE)"

2 replies

null
    • SMoore
    • 2 mths ago
    • Reported - view

    So, my formula works beautifully.

     

    The problem is related to functions.

     

    I tried creating a local function, and received the same result. Readable if works if stored locally or globally. Writable if does not work in either scenario. Does anyone have any workaround suggestions?

    • SMoore
    • 2 mths ago
    • Reported - view

    Update #2:

    I created a formula in a table:

    let currentUser := first(select 'System User' where int_linked_user = user() or Email = userEmail()).Id;
    let newPerm := text(upper(record('System User',currentUser).int_permissions_list));
    contains(newPerm, upper("System Users (Modify)"))
    

    Which returns true or false.

     

    Readable if still displays the specified field if true is returned. But in Writable if, the record still cannot be modified.  So its not functions, could it be the contains statement that Writable if does not like?

Content aside

  • 2 mths agoLast active
  • 2Replies
  • 36Views
  • 1 Following