News:

Support the VirtueMart project and become a member

Main Menu

bug in mod_virtuemart.php

Started by ocean1, June 11, 2009, 00:36:20 AM

Previous topic - Next topic

ocean1

user groeps is not working in the module mod_virtuemart.php.
when you add a new groep, the module is not responding because of the code <code> if ($perm->check("admin,storeadmin") </code>


mauri

#1
I think it´s not a bug.
Go VM backend, open List Modules and give some perms to new group.

edit: Maybe perms only to module accout, like shopper and demo.
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

ocean1

#2
i can't select any groups in the mod_virtuemart.
this module is the frontend administration login.
did you allready try it your self?

i made a copy of storeadmin named demo
mod_virtuemart works voor storeadmin and not for demo

ocean1

#3
This part is not working correct
<code>
// Show the Frontend ADMINISTRATION Link
if ($perm->check("admin,storeadmin")
      && ((!stristr($my->usertype, "admin") ^ PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS == '' )
          || stristr($my->usertype, "admin")
      )
      && $show_adminlink == 'yes'
    ) { ?>
    <tr>
      <td colspan="2">
         <a class="<?php echo $class_mainlevel ?>" href="<?php $sess->purl(SECUREURL . "index2.php?page=store.index&pshop_mode=admin") ?>">
         <?php echo $VM_LANG->_('PHPSHOP_ADMIN_MOD'); ?>
         </a>
      </td>
    </tr>
  <?php
}
</code>


And now its working
<code>
// Show the Frontend ADMINISTRATION Link
if ($perm->check("admin,storeadmin,beheerder")
      && ((!stristr($my->usertype, "admin") ^ PSHOP_ALLOW_FRONTENDADMIN_FOR_NOBACKENDERS == '' )
          || stristr($my->usertype, "admin")
      )
      && $show_adminlink == 'yes'
    ) { ?>
    <tr>
      <td colspan="2">
         <a class="<?php echo $class_mainlevel ?>" href="<?php $sess->purl(SECUREURL . "index2.php?page=store.index&pshop_mode=admin") ?>">
         <?php echo $VM_LANG->_('PHPSHOP_ADMIN_MOD'); ?>
         </a>
      </td>
    </tr>
  <?php
}
</code>

So it would be nice that this part is also working

ocean1

sorry may be its not a bug but a new idea for the next version

mauri

#5
OK. Now I understand. You made a new "admin" usergroup(beheerder) and will that mod_virtuemart module shows the administration link to that usergroup.
I would say it´s a bug. You fix it in your way.  ;D
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

ocean1

oke thanks
i will try it next week

mauri

This bug is fixed in version 1.1.4
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11

Harry

Thank you, thank you, thank you ocean1 for finding this. I've already wasted too much time on this issue trying to fix this via the web interface. I could have found the error in the code once I realized that there was one but that would have taken even longer.

For those of you who are new to this issue. I created a new User Group. I gave this User Group administrator permissions. I created a new user and assigned it to the new User Group. The problem was when I logged in from the frontend, the Admin link would not show even though I had given the User Group admin permissions.
What ocean1 discovered is that mod_virtuemart.php was hardcoded to limit frontend admin access to "admin" and "storeadmin".

But wait. There's more!

I fixed that by adding my User Groups into the code of mod_virtuemart.php and was now able to see an Admin link on the frontend. But when I clicked on the admin link on the frontend I got an ugly unformatted menu. Well after a quick search (thanks to ocean1 I knew what to look for) I discovered that the component itself also has a bug. If you look in virtuemart.php you'll find that "admin" and "storeadmin" are hardcoded there also

<code>
** FRONTEND ADMIN - MOD
**/
if ( vmIsAdminMode()
   && $perm->check("admin,storeadmin")
</code>

So you have to fix it there also.

OK, upon further inquiry I see that this mess is hardcoded like this throughout the whole application.

This really needs to be fixed in the next release.

mauri

Quote from: Harry on July 07, 2009, 21:22:50 PM

So you have to fix it there also.

OK, upon further inquiry I see that this mess is hardcoded like this throughout the whole application.

This really needs to be fixed in the next release.

Yes, it´s fixed in whole virtuemart  ;)
VirtueMart,(Joomla-phpShop, mambo-phpShop) since 2004-03-11