Joomla plugin Spreadsheet: Access rights for user groups.

I know from the “Scheduler for Joomla and WP” thread (http://forum.dhtmlx.com/viewtopic.php?f=16&t=21783&p=70859&hilit=joomla+plugin+user+group#p70859) that you will adjust the user group access rights in the early comming update of the dhtmlxScheduler plugin for Joomla.

Do you plan the same fixture of the access right management at the dhtmlxSpreadsheedt plugin for Joomla (and WP)?

If yes, when do you roughly expect the update? Where do you announce the update release? In this forum?

Unfortunately, the right to edit spreadsheet data is crucial for our registered members. This would bring your wonderful plugin to an absolute perfection. I really look forward to update the plugin and thank you for the superb work! :smiley:

Hi,
thanks for your feedback.
We don’t have plans to implement admin panel for user access management.
So there is only way to configure access rights only in dhtmlxspreadsheet.php file.

Thank you for your fast reply. I have already tried to complement the array for the access groups in the “spreadsheet-data.php”:

Before modification:
Line 50 pp

$available_to = Array(
	'Super Users' => true,
	'superadministrator' => true,
	'administrator' => true,
	'manager' => true,
);

After modification:
Line 50 pp

$available_to = Array(
	'Super Users' => true,
	'superadministrator' => true,
	'administrator' => true,
	'manager' => true,
        'editor' => true,
	'registered' => true
);

Unfortunately, it didn’t work. Anything else, that I have to adjust. Thank you for your help…

Hi,
please, try to update plugin from attachment.
com_spreadsheet.zip (1.8 MB)

Dear radyno,

thank you for your quick reply. Unfortunately, I do not observe any change. The access rights, that allow spreadsheet editing, were not extended to the group of registered members. The only change I can report is, that no spreadsheet is displayed at all.

Excerpt of the resulting HTML code

<script src='http://mydomain.my/plugins/content/spreadsheet/codebase/spreadsheet.php?load=js' type='text/javascript' charset='utf-8'></script>
<link rel='stylesheet' href='http://mydomain.my/plugins/content/spreadsheet/codebase/dhtmlx_core.css' type='text/css' charset='utf-8'>
<link rel='stylesheet' href='http://mydomain.my/plugins/content/spreadsheet/codebase/dhtmlxspreadsheet.css' type='text/css' charset='utf-8'>
<link rel='stylesheet' href='http://mydomain.my/plugins/content/spreadsheet/codebase/dhtmlxgrid_reset.css' type='text/css' charset='utf-8'>


<script>var dhx_sh;
function onload_func_344448() {
    window.setTimeout(function() {
        var cfg = {
    sheet: '1',
    dhx_rel_path: 'http://mydomain.my/plugins/content/spreadsheet/codebase/',
    parent: 'spreadsheet_box_344448',
    load: 'http://mydomain.my/plugins/content/spreadsheet/spreadsheet_data.php',
    save: 'http://mydomain.my/plugins/content/spreadsheet/spreadsheet_data.php',
skin: 'dhx_skyblue',
math: false,
autowidth: false,
autoheight: true
}

dhx_sh = new dhtmlxSpreadSheet({
            load: cfg.load,
            save: cfg.save,
            parent: cfg.parent,
            autowidth: cfg.autowidth,
            autoheight: cfg.autoheight,
            skin: cfg.skin,
            math: cfg.math,
            icons_path: cfg['dhx_rel_path'] + 'imgs/icons/',
            image_path: cfg['dhx_rel_path'] + 'imgs/'
        });
        dhx_sh.load(cfg.sheet||'1', cfg.key||null);
    }, 1);
}
dhtmlxEvent(window, 'load', onload_func_344448);</script><div id='spreadsheet_box_344448' style='width: 100%; height: auto; background-color:white;'></div>

I compared the previous version of the plugin with the recent update, that you attached to your reply. You will find a screen shot of the comparison performed with Meld. I couldn’t find relevant changes in the files, which is probably caused by my poor PHP knowledge :question: I can’t find changes between the previous plugin version and your recent update, that are correlated to user rights. I don’t now where to look, to give a more precise description. Please give me a hint, so I can look more close on the problem.

Thank you very much!


Hi,
please, open spreadsheet_data.php file and modify it like here:

echo "<pre>";
print_r($available_to);
print_r($usergroups);
echo "</pre>";
if (!dhx_can($available_to, $usergroups))
	$conn->set_read_only(true);
$conn->render();

After that some debug data will be output before spreadsheet.
Could you provide it?

Funny enough, but if I add your code snippet to debug the “$available_to” and the “$usergroups” in “spreadsheet_data.php” the table rendering is killed half way proceeding. It looks like, as if the procedure is not able to finish the rendering of the table. Firebug gives me the following debug protocol:

Just to give you the full picture, I added your debug snippet to “spreadsheet_data.php” as follows:

echo "<pre>";
print_r($available_to);
print_r($usergroups);
echo "</pre>";
if (!dhx_can($available_to, $usergroups))
   $conn->set_read_only(true);
$conn->render();

// if (!dhx_can($available_to, $usergroups))
//	$conn->set_read_only(true);
// $conn->render();

But never mind! :sunglasses: I got the response on the GET request with Firebug and that is what counts. The array of “$available_to” and “$usergroups” looks like this

As far as I understand, the spreadsheet script only knows the user group “Super Users”. Does that mean, that I have to extend the definition of “$usergroups” somewhere in the code? If yes, where? Or am I completely wrong?

Hi,
$usergroups contains a list of user groups. In your case current user is only in group Super Users.
$available_to contains list of groups whos users can edit spreadsheet.
So script checks if current usergroups are allowed in $available_to and sets readonly mode if user don’t have permissions to edit ssheet.
It looks like it works correctly. isn’t it?

You are right, the script gets all the needed parameters. The reason why it still doesn’t work, is the case sensitivity in the definition of allowed users. In line 48 - 55 of “spreadsheet_data.php” you define the access rights.

$available_to = Array(
	'Super Users' => true,
	'superadministrator' => true,
	'administrator' => true,
	'manager' => true,
	'editor' => true,
	'registered' => true
);

In line 111 to 119 you set associate the user rights definition to the Joomla users.

		$groups = array(
			'registered' => 'Registered',
			'author' => 'Author',
			'editor' => 'Editor',
			'publisher' => 'Publisher',
			'manager' => 'Manager',
			'administrator' => 'Administrator',
			'superadministrator' => 'Super administrator'
		);

Here you use capital letter. That was the reason, why the Joomla user could not get the set access rights. I changed the writing of the allowed users in the “$available_to” array and it works!

$available_to = Array(
	'Super Users' => true,
	'superadministrator' => true,
	'Administrator' => true,
	'Manager' => true,
	'Editor' => true,
	'Registered' => true
);

Sometimes it can be so easy and so obvious. Unfortunately my PHP knowledge was so poor, that I didn’t see it by myself. Thank you for your help.

Request SOLVED!