VirtueMart Forum

VirtueMart Dev/Coding Central: VM1 (old version) => Quality & Testing VirtueMart 1.1.x => Virtuemart 1.1 Development (Archiv) => Q&T Resolved => Topic started by: ocean1 on June 11, 2009, 00:36:20 AM

Title: bug in mod_virtuemart.php
Post by: ocean1 on June 11, 2009, 00:36:20 AM
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>

Title: Re: bug in mod_virtuemart.php
Post by: mauri on June 11, 2009, 18:44:12 PM
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.
Title: Re: bug in mod_virtuemart.php
Post by: ocean1 on June 12, 2009, 07:12:26 AM
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
Title: Re: bug in mod_virtuemart.php
Post by: ocean1 on June 12, 2009, 08:00:17 AM
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
Title: Re: bug in mod_virtuemart.php
Post by: ocean1 on June 12, 2009, 08:01:43 AM
sorry may be its not a bug but a new idea for the next version
Title: Re: bug in mod_virtuemart.php
Post by: mauri on June 12, 2009, 19:48:17 PM
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
Title: Re: bug in mod_virtuemart.php
Post by: ocean1 on June 12, 2009, 20:01:51 PM
oke thanks
i will try it next week
Title: Re: bug in mod_virtuemart.php
Post by: mauri on June 15, 2009, 11:29:40 AM
This bug is fixed in version 1.1.4
Title: Re: bug in mod_virtuemart.php
Post by: Harry on July 07, 2009, 21:22:50 PM
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.
Title: Re: bug in mod_virtuemart.php
Post by: mauri on July 07, 2009, 22:11:46 PM
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  ;)