1
iliakros
Smartpartner permissions hidden
  • 2012/5/12 13:37

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


In the file

modules/smartpartner/admin/partner.php line 251

global $smartpermissions_handler;
include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
$smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);

if($partnerObj->id() != 0){
$grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $partnerObj->id());
}else{
$grantedGroups = $xoopsModuleConfig['default_full_view'];
}
$full_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_FULL_PERM_READ, 'full_view', true, $grantedGroups, 5, true);
$full_view_select->setDescription(_CO_SPARTNER_FULL_PERM_READ_DSC);
$sform->addElement($full_view_select);

if($partnerObj->id() != 0){
$partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $partnerObj->id());
}else{
$partGrantedGroups = $xoopsModuleConfig['default_part_view'];
}
$part_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_PART_PERM_READ, 'partial_view', true, $partGrantedGroups, 5, true);
$part_view_select->setDescription(_CO_SPARTNER_PART_PERM_READ_DSC);
$sform->addElement($part_view_select);

I don't want the permissions to be visible, but have a default value.
In the preferences you can set the default, so thats not the problem.
The problem is I can't make it hidden.
I tried using xoopsFormHidden, but I don't know which value to use and can't get it to work.

Does someone know which value to use or another solution for my problem?

Many thanks

2
zyspec
Re: Smartpartner permissions hidden
  • 2012/5/12 18:08

  • zyspec

  • Module Developer

  • Posts: 1095

  • Since: 2004/9/21


If you replace the code above with:
global $smartpermissions_handler;
include_once 
XOOPS_ROOT_PATH '/modules/smartobject/class/smartobjectpermission.php';
$smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);

$sform->addElement(new XoopsFormHidden('full_view'$xoopsModuleConfig['default_full_view']));
$sform->addElement(new XoopsFormHidden('partial_view'$xoopsModuleConfig['default_part_view']));


everyone will have the permissions you set in module config...

3
iliakros
Re: Smartpartner permissions hidden
  • 2012/5/12 18:32

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


Thanks for your reply

I actually tried that, but when I open the partner page (modules/smartpartner/partner.php?id= ) I get a corruptedContentError.

So I am thinking, the wrong value is send or is there something else going on or wrong?

4
iliakros
Re: Smartpartner permissions hidden
  • 2012/5/14 8:57

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


I digged a little and found out that the group permissions are not saved in table

group_permissions

Anyone any ideas how to solve this?

Thanx

5
iliakros
Re: Smartpartner permissions hidden
  • 2012/5/14 11:15

  • iliakros

  • Just popping in

  • Posts: 21

  • Since: 2009/11/3


With xoopsFormHidden you can't send an array, which is what I was trying to do.
To sove this

command out the following lines (251-271)

/*global $smartpermissions_handler;
    include_once XOOPS_ROOT_PATH . '/modules/smartobject/class/smartobjectpermission.php';
    $smartpermissions_handler = new SmartobjectPermissionHandler($smartpartner_partner_handler);

    if($partnerObj->id() != 0){
        $grantedGroups = $smartpermissions_handler->getGrantedGroups('full_view', $partnerObj->id());
    }else{
        $grantedGroups = $xoopsModuleConfig['default_full_view'];
    }
    $full_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_FULL_PERM_READ, 'full_view', true, $grantedGroups, 5, true);
    $full_view_select->setDescription(_CO_SPARTNER_FULL_PERM_READ_DSC);
    $full_view_select->setHidden();
    $sform->addElement($full_view_select);

    if($partnerObj->id() != 0){
        $partGrantedGroups = $smartpermissions_handler->getGrantedGroups('partial_view', $partnerObj->id());
    }else{
        $partGrantedGroups = $xoopsModuleConfig['default_part_view'];
    }
    $part_view_select = new XoopsFormSelectGroup(_CO_SPARTNER_PART_PERM_READ, 'partial_view', true, $partGrantedGroups, 5, true);
    $part_view_select->setDescription(_CO_SPARTNER_PART_PERM_READ_DSC);
    $part_view_select->setHidden();
    $sform->addElement($part_view_select);*/


Go to line 433 and add

$_POST['full_view'] = array(=> 1=> 2=> 3);


or at least put this line under
case "addpartner":

This way the array is not send, but already present.

BTW with this array all the default groups have full access, so if you have more groups, or don't want all groups to have access, you have to modify the array.
Same goes for the partial view add

$_POST['part_view'] = array(=> 1=> 2=> 3);


with the array that suits your needs

Login

Who's Online

173 user(s) are online (96 user(s) are browsing Support Forums)


Members: 0


Guests: 173


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: May 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits