Example #1
0
 /**
  * Redirect to a url if user does not have permission for an item
  *
  * @param string $gperm_name   name of the permission to test
  * @param int    $gperm_itemid id of the object to check
  * @param string $url          module relative url to redirect to
  * @param int    $time         time in seconds to delay
  * @param string $message      message to display with redirect
  *
  * @return void
  **/
 public function checkPermissionRedirect($gperm_name, $gperm_itemid, $url, $time = 3, $message = '')
 {
     $gperm_groupid = \Xoops::getInstance()->getUserGroups();
     $permission = $this->permissionHandler->checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $this->mid);
     if (!$permission) {
         $helper = Helper::getHelper($this->dirname);
         $helper->redirect($url, $time, $message);
     }
 }
Example #2
0
 /**
  * Check permission
  *
  * @param string    $gperm_name
  * @param int       $gperm_itemid
  * @param array|int $gperm_groupid
  * @param int       $gperm_modid
  * @param bool      $trueifadmin
  *
  * @return bool
  */
 public function checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1, $trueifadmin = true)
 {
     $trueifadmin = false;
     return parent::checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid, $trueifadmin);
 }