15 public $mValue = USER_PERMISSION_NONE;
22 public function __construct($groupId, &$item)
24 $this->mGroupId = $groupId;
25 $this->mItem =& $item;
29 public function getId()
31 return $this->mItem->getId();
34 public function getValue()
39 public function setValue($value)
42 $this->mValue = $value & (USER_PERMISSION_READ | USER_PERMISSION_ADMIN);
45 public function _load()
47 $this->mValue = $this->mItem->loadPermission($this->mGroupId);
55 $gpermHandler =& xoops_gethandler(
'groupperm');
57 $name = $this->mItem->getReadPermName();
59 $gperm =& $this->_createGperm($name);
60 if (!$gpermHandler->insert($gperm)) {
65 $name = $this->mItem->getAdminPermName();
67 $gperm =& $this->_createGperm($name);
68 if ($gpermHandler->insert($gperm)) {
76 public function _createGperm($gperm_name =
null)
78 $gpermHandler =& xoops_gethandler(
'groupperm');
79 $gperm =& $gpermHandler->create();
81 $gperm->setVar(
'gperm_groupid', $this->mGroupId);
82 $gperm->setVar(
'gperm_itemid', $this->getId());
83 $gperm->setVar(
'gperm_modid', 1);
84 $gperm->setVar(
'gperm_name', $gperm_name);
145 public function __construct(&$module)
147 $this->mModule =& $module;
152 return $this->mModule->getVar(
'mid');
157 return $this->mModule->getProperty(
'name');
169 public function loadPermission($groupId)
171 $ret = USER_PERMISSION_NONE;
173 $gpermHandler =& xoops_gethandler(
'groupperm');
174 if ($gpermHandler->checkRight(
'module_admin', $this->mModule->getVar(
'mid'), $groupId)) {
175 $ret |= USER_PERMISSION_ADMIN;
178 if ($gpermHandler->checkRight(
'module_read', $this->mModule->getVar(
'mid'), $groupId)) {
179 $ret |= USER_PERMISSION_READ;
187 return 'module_read';
192 return 'module_admin';
252 public function __construct($id, $name)
255 $this->mName = $name;
277 public function loadPermission($groupId)
279 $ret = USER_PERMISSION_NONE;
281 $gpermHandler =& xoops_gethandler(
'groupperm');
282 if ($gpermHandler->checkRight(
'system_admin', $this->mId, $groupId)) {
283 $ret |= USER_PERMISSION_ADMIN;
291 return 'system_admin';