@@ 328-345 (lines=18) @@ | ||
325 | * @param integer $itemID : faqid on which we are setting permissions |
|
326 | * @return boolean : TRUE if the no errors occured |
|
327 | */ |
|
328 | function sf_saveItemPermissions($groups, $itemID) |
|
329 | { |
|
330 | $result = true; |
|
331 | $smartModule = sf_getModuleInfo(); |
|
332 | $module_id = $smartModule->getVar('mid'); |
|
333 | ||
334 | $gpermHandler = xoops_getHandler('groupperm'); |
|
335 | // First, if the permissions are already there, delete them |
|
336 | $gpermHandler->deleteByModule($module_id, 'item_read', $itemID); |
|
337 | // Save the new permissions |
|
338 | if (count($groups) > 0) { |
|
339 | foreach ($groups as $group_id) { |
|
340 | $gpermHandler->addRight('item_read', $itemID, $group_id, $module_id); |
|
341 | } |
|
342 | } |
|
343 | ||
344 | return $result; |
|
345 | } |
|
346 | ||
347 | /** |
|
348 | * Saves permissions for the selected category |
|
@@ 358-375 (lines=18) @@ | ||
355 | * @return boolean : TRUE if the no errors occured |
|
356 | */ |
|
357 | ||
358 | function sf_saveCategory_Permissions($groups, $categoryid, $perm_name) |
|
359 | { |
|
360 | $result = true; |
|
361 | $smartModule = sf_getModuleInfo(); |
|
362 | $module_id = $smartModule->getVar('mid'); |
|
363 | ||
364 | $gpermHandler = xoops_getHandler('groupperm'); |
|
365 | // First, if the permissions are already there, delete them |
|
366 | $gpermHandler->deleteByModule($module_id, $perm_name, $categoryid); |
|
367 | // Save the new permissions |
|
368 | if (count($groups) > 0) { |
|
369 | foreach ($groups as $group_id) { |
|
370 | $gpermHandler->addRight($perm_name, $categoryid, $group_id, $module_id); |
|
371 | } |
|
372 | } |
|
373 | ||
374 | return $result; |
|
375 | } |
|
376 | ||
377 | /** |
|
378 | * Saves permissions for the selected category |
|
@@ 387-404 (lines=18) @@ | ||
384 | * @return boolean : TRUE if the no errors occured |
|
385 | */ |
|
386 | ||
387 | function sf_saveModerators($moderators, $categoryid) |
|
388 | { |
|
389 | $result = true; |
|
390 | $smartModule = sf_getModuleInfo(); |
|
391 | $module_id = $smartModule->getVar('mid'); |
|
392 | ||
393 | $gpermHandler = xoops_getHandler('groupperm'); |
|
394 | // First, if the permissions are already there, delete them |
|
395 | $gpermHandler->deleteByModule($module_id, 'category_moderation', $categoryid); |
|
396 | // Save the new permissions |
|
397 | if (count($moderators) > 0) { |
|
398 | foreach ($moderators as $uid) { |
|
399 | $gpermHandler->addRight('category_moderation', $categoryid, $uid, $module_id); |
|
400 | } |
|
401 | } |
|
402 | ||
403 | return $result; |
|
404 | } |
|
405 | ||
406 | /** |
|
407 | * @param int $faqid |