News:

Support the VirtueMart project and become a member

Main Menu

Permission "Manager" Backend

Started by Fenicexx, December 28, 2012, 23:34:38 PM

Previous topic - Next topic

Fenicexx

Hi,
use joomla 2.5.8 and vm 2.0.16.

I created a user manager and I want this to be able to have permission to view backend vm.
In this version of vm I noticed that there is not the usual "Options" button to change the permissions.

I performed this procedure (with negative results) to display the options button:

administrator/components/com_virtuemart/virtuemart.xml I inserted the code:

<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
<field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" component="com_foobar" section="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
</field>
</fieldset>


administrator/components/com_virtuemart/admin.virtuemart.php I commented out of code:

if ( !JVM_VERSION===1) {
if (!JFactory::getUser()->authorise('core.manage', 'com_virtuemart')) {
return JError::raiseWarning(404, JText::_('JERROR_ALERTNOAUTHOR'));
}
}


administrator/components/com_virtuemart/views/virtuemart/view.html.php I commented out of code:
if ( !JVM_VERSION===1) {
if (JFactory::getUser()->authorise('core.admin', 'com_virtuemart')) {
JToolBarHelper::preferences('com_virtuemart');
}
}


administrator/language/en-GB/en-GB.com_virtuemart.ini I added the line:

COM_VIRTUEMART_CONFIGURATION="VirtueMart Options"

The "Options" button does not appear, where am I wrong?
Any other ideas? There are other ways to solve this problem?

PS:I followed this tutorial: http://www.aclmanager.net/it/blog/general/31-how-to-add-basic-acl-support-to-your-extension

tnx

McKillo

Wrong File: administrator/components/com_virtuemart/virtuemart.xml
In the original article, you can read: Create the following file and add the code below. File: administrator/components/com_foobar/config.xml
I must create this file doesn't exist: administrator/components/com_virtuemart/config.xml
Create it and try it again.
Dev/Real: VM 3.4.3.x + JL 3.9.3 + PHP 7.2.15 VM Silver Certified

Fenicexx

I deleted:

<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
<field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" component="com_virtuemart" section="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
</field>
</fieldset>


from administrator/components/com_virtuemart/virtuemart.xml and I created the file config.xml in administrator/components/com_virtuemart/config.xml:

<?xml version="1.0" encoding="utf-8"?>
<config>
<fieldset name="permissions" label="JCONFIG_PERMISSIONS_LABEL" description="JCONFIG_PERMISSIONS_DESC">
<field name="rules" type="rules" label="JCONFIG_PERMISSIONS_LABEL" filter="rules" component="com_virtuemart" section="component">
<action name="core.admin" title="JACTION_ADMIN" description="JACTION_ADMIN_COMPONENT_DESC" />
<action name="core.manage" title="JACTION_MANAGE" description="JACTION_MANAGE_COMPONENT_DESC" />
</field>
</fieldset>
</config>


but the "option" is not displayed :(

McKillo

In the Step 3: Add the 'Options' toolbar button ....
but you can't add that code because "protected function addToolbar()" doesn't exit into administrator/components/com_virtuemart/views/virtuemart/view.html.php file.

First: there is to develp the class ...

class VirtuemartViewVirtuemarts extends JViewLegacy (or similar)
{
        ...
        // Options button
        if (JFactory::getUser()->authorise('core.admin', 'com_virtuemart')) {
       JToolBarHelper::preferences('com_virtuemart');
        }
}

I done any test about it, but it didn't work. I don't know, if maybe we'll have ACL for VM in the next v.2.1  with Options button for permissions.
       
Dev/Real: VM 3.4.3.x + JL 3.9.3 + PHP 7.2.15 VM Silver Certified