Roles or acl rights for the logged in user

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • rouhu
    Member
    • Sep 2020
    • 39

    Roles or acl rights for the logged in user

    In Formula script I am trying to find users roles or access to entity.

    This does not return anything:
    env\userAttribute('rolesIds')

    Then these gives errors:
    $user_id=env\userAttribute('id');
    $action='Create';
    $scope='Approvals';
    $is_approver=ext\acl\getLevel($user_id,$scope,$act ion);

    -> Function ext\acl\getLevel; Bad argument value on position 3.

    This one gives error in log:
    $user_id=env\userAttribute('id');
    $action='Create';
    $scope='Approvals';​
    $is_approver=ext\acl\checkScope($user_id,$scope,$a ction);​

    [2024-11-06 15:21:24] ERROR: Slim Application Error Type: Error Code: 0 Message: Call to private method Espo\Core\Acl\DefaultAccessChecker::checkScope() from scope Espo\Core\AclManager File: /home/kms/public_html/application/Espo/Core/AclManager.php Line: 443 Trace: #0 /home/kms/public_html/application/Espo/Core/Formula/Functions/ExtGroup/AclGroup/CheckScopeType.php(78): Espo\Core\AclManager->checkScope() #1 /home/kms/public_html/application/Espo/Core/Formula/Processor.php(180): Espo\Core\Formula\Functions\ExtGroup\AclGroup\Chec kScopeType->process() #2 /home/kms/public_html/application/Espo/Core/Formula/Processor.php(98): Espo\Core\Formula\Processor->processFunc() #3 ...

    I just need the Roles of the user logged on. Any ideas ?

    Thanks, Tim
  • emillod
    Active Community Member
    • Apr 2017
    • 1405

    #2
    In most scenarios entities are named in singular, so it should be Approval instead of Approvals i think.

    Comment

    Working...