File size: 1.38Kb
<?php
namespace MMO\Hide\XF\Entity;
class User extends XFCP_User
{
/**
* @param $tag
*
* @return bool
*/
public function canUseHideTag($tag): bool
{
return $this->hasPermission('mh_hide', "useTag{$tag}");
}
/**
* @param $tag
* @param int|null $node
*
* @return bool
*/
public function canBypassHideTag($tag, ?int $node = null): bool
{
if ($node !== null)
{
if($this->hasNodePermission($node, 'editAnyPost')
|| $this->hasNodePermission($node, 'deleteAnyPost')
)
{
return true;
}
return $this->hasNodePermission($node, "bypassTag{$tag}");
}
return $this->hasPermission('mh_hide', "bypassTag{$tag}");
}
public function canIgnoreHideTagCondition($tag, $tagOption): bool
{
$tag = \ucfirst($tag);
$limit = $this->hasPermission('mh_hide', "ignoreTag{$tag}");
if($tagOption <= $limit || $limit == -1)
{
return true;
}
return false;
}
/**
* @return bool
*/
public function canBypassAnyTag(): bool
{
if ($this->is_super_admin)
{
return true;
}
return $this->hasPermission('mh_hide', 'bypassAnyTag');
}
}