55 public function id($format =
'n')
57 return $this->
getVar(
'gperm_id', $format);
66 return $this->
getVar(
'gperm_id', $format);
75 return $this->
getVar(
'gperm_groupid', $format);
84 return $this->
getVar(
'gperm_itemid', $format);
93 return $this->
getVar(
'gperm_modid', $format);
102 return $this->
getVar(
'gperm_name', $format);
127 parent::__construct($db,
'group_permission',
'XoopsGroupPerm',
'gperm_id',
'gperm_name');
141 if (isset($gperm_modid)) {
156 public function deleteByModule($gperm_modid, $gperm_name = null, $gperm_itemid = null)
159 if (isset($gperm_name)) {
161 if (isset($gperm_itemid)) {
179 public function checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1, $trueifadmin =
true)
181 if (empty($gperm_groupid)) {
184 if (is_array($gperm_groupid)) {
185 if (in_array(FixedGroups::ADMIN, $gperm_groupid) && $trueifadmin) {
189 foreach ($gperm_groupid as $gid) {
190 $criteria_group->add(
new Criteria(
'gperm_groupid', $gid),
'OR');
193 if (FixedGroups::ADMIN == $gperm_groupid && $trueifadmin) {
202 $gperm_itemid = intval($gperm_itemid);
203 if ($gperm_itemid > 0) {
222 function addRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid = 1)
225 $perm->setVar(
'gperm_name', $gperm_name);
226 $perm->setVar(
'gperm_groupid', $gperm_groupid);
227 $perm->setVar(
'gperm_itemid', $gperm_itemid);
228 $perm->setVar(
'gperm_modid', $gperm_modid);
229 return $this->
insert($perm);
241 public function getItemIds($gperm_name, $gperm_groupid, $gperm_modid = 1)
246 if (is_array($gperm_groupid)) {
248 foreach ($gperm_groupid as $gid) {
256 foreach (array_keys($perms) as
$i) {
257 $ret[] = $perms[
$i]->getVar(
'gperm_itemid');
259 return array_unique($ret);
271 public function getGroupIds($gperm_name, $gperm_itemid, $gperm_modid = 1)
278 foreach (array_keys($perms) as
$i) {
279 $ret[] = $perms[
$i]->getVar(
'gperm_groupid');
gperm_groupid($format= '')
getCount(CriteriaElement $criteria=null)
insert(XoopsObject $object, $force=true)
gperm_itemid($format= '')
getVar($key, $format= 's')
addRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid=1)
deleteByGroup($gperm_groupid, $gperm_modid=null)
getObjects(CriteriaElement $criteria=null, $id_as_key=false, $as_object=true)
getGroupIds($gperm_name, $gperm_itemid, $gperm_modid=1)
deleteAll(CriteriaElement $criteria, $force=true, $asObject=false)
checkRight($gperm_name, $gperm_itemid, $gperm_groupid, $gperm_modid=1, $trueifadmin=true)
initVar($key, $data_type, $value=null, $required=false, $maxlength=null, $options= '')
__construct(Connection $db=null)
getItemIds($gperm_name, $gperm_groupid, $gperm_modid=1)
deleteByModule($gperm_modid, $gperm_name=null, $gperm_itemid=null)