Questions and discussion about developing processes and programming in PHP, JavaScript, web services & REST API.
Forum rules: Please search to see if a question has already asked before creating a new topic. Please don't post the same question in multiple forums.
User avatar
By amosbatto
#814260
As Alan says, you need to add a permission to the plugin and then assign that permission to the role of the users who need to access your External page. Then in the code for your External page, add this code to check for the permission:
Code: Select all
<?php
//if the login session has timed out, then redirect to the login page:
if (empty($_SESSION['USER_LOGGED']) {
   header("location: ../login/login");
}

//if the user doesn't have PM_MYPERMISSION in his/her role, then either display a message saying that 
//access isn't permitted:
global $RBAC;
if ($RBAC->userCanAccess('PM_MYPERMISSION') != 1) {
    echo "Access is only permitted for users with PM_MYPERMISSION in their role"; 
    die;
} 
By hmxDavid
#814306
Thanks Alan and amos. It works. I tried to add in the past a custom role, what I lack is the code provided by amos to check for the permission. I never thought that I can call the global $RBAC :lol:

Thanks guys

DO we have to pay tax for trade https://www.getfir[…]

Mosquito Zapper Reviews

https://www.facebook.com/sammosquitozapper https:[…]

https://www.facebook.com/sammosquitozapper https:[…]

Are you looking for a simple method to import EML […]