Using IsSysAdminUser(), IsSysAdmin()

is there a trick to using the new security objects, everything i try to access returns nothing..

logged in with administrator account == -1, this does not exit the function

    // Page Data Rendered event
    public function pageDataRendered(string &$footer): void
    {
        $footerMsg = "";
        if(IsSysAdminUser()) 
            return;  

same with Security()->IsSysAdmin()

is this only applicable for the hardcoded admin account?

thanks

  1. Note the Page_DataRendered is used to set the $footer (content at the end of the page). Returning there only means there is no $footer, nothing more.
  2. IsSysAdminUser() and Security()->IsSysAdmin() is used to check if the current user is super admin. Your code means: if the current user is super admin, no footer. Is that what you want to do?
  3. You may also check your current user level info by Security()->showUserLevelInfo().

This is correct, admin should return as there is a message that is displayed for users if they exceed their storage space and disables insert functionality, but as an admin - this would not apply, but its not detecting any admin level (eg: -1)

this is a default phpM generated module no custom file, not sure as to why isSysAdmin is not return -1

Put it in your Page_DataRendered. What did you see?

I think we're good.

  • thought IsSysAdmin would recognize a table user id = -1..., which it doesn't hence the function falling though..
  • just added isSysAdmin as well to the check and the function responds accordinly.
    Thanks!