is_admin_user
is_admin_user says weather the currently logged in user is an admin user. Generally used for extra security checks just prior to performing critical admin-only operations.
Best Practice: use this before performing sensitive operations
This function always goes all the way back to the server and database to detect weather the current session is logged in ad the administrator, so that it can never be spoofed by anything done on the client (mobile device) side. It is good practice to check this before performing any type of critical operations requiring admin access and *Not* just use the global var is_admin_user
Format:
is_admin_user()
Parameters:
This function does not take any parameters.
Returned Value:
| Type | Description |
|---|---|
| boolean | TRUE if the user is logged in as the administrator, FALSE otherwise |
Examples
if (!is_admin_user()) {
application.status = "approved"
}
else {
alert("You have to be the administrator to approve an application!")
}