Project

General

Profile

Actions

Feature #17564

closed

RFC: Extended BE Module "Web/Permissions"

Added by Andreas Beutel over 16 years ago. Updated over 13 years ago.

Status:
Closed
Priority:
Should have
Assignee:
Category:
-
Target version:
-
Start date:
2007-08-27
Due date:
% Done:

0%

Estimated time:
PHP Version:
4.3
Tags:
Complexity:
Sprint Focus:

Description

When you have to deal with large sites and complex page permssions the current permissions module is slightly unhandy to fine tune permissions.

As an add on to the existing module »Web/Permissions« I added some functionality to provide convenient methods of changing the permission bitmask by clicking on the matrix as well as editing the owner and group in place.

Patchfiles for index.php of shipped module (as of TYPO3 4.1.2 and SVN Trunk) and the additional required file (to be put in in typo3/mod/web/perms/).

Apply the provided patch file to your copy of TYPO3 4.1.2:
patch -p1 typo3/mod/web/perm/index.php < t3_412_mod_web_perm_index.php.diff

Copy the additional file »permAjaxResponder.php« to »typo3/mod/web/perm/«

Still to do:

- fix some CSS issues
- the translation handling in the AJAX responder
(issue imported from #M6220)


Files

T3_413_mod_perm.zip (9.03 KB) T3_413_mod_perm.zip Administrator Admin, 2007-11-09 10:53
mod_web_perm_TYPO3_4-2_3236.tar.gz (14.7 KB) mod_web_perm_TYPO3_4-2_3236.tar.gz Administrator Admin, 2008-02-20 10:20
20080221_ajax_permissions_2.patch (50.8 KB) 20080221_ajax_permissions_2.patch Administrator Admin, 2008-02-21 18:08
Actions #1

Updated by Andreas Beutel over 16 years ago

In the attached file »6220_permissions_example.png« you can see what changes:

- you can click each allowed or denied symbol (asterisk (*) or the x) to toggle the permission
- you can click on the owner and group name for in place editing

The update of the view should happen immediately for the permissions and after pressing the save button for owner and group.

Actions #2

Updated by Benni Mack over 16 years ago

Hi Andreas,

interesting patch. Some things I checked while reading your patch:

can you outsource the static javascript in a file mod_perms.js and include it in your PHP file? I'd then (after you uploaded it again) go over your JS code and make it object oriented to give it a nice namespace etc.

also: since you're with prototype you can use $(elementID) instead of document.getElementByID(elementID)

As for the permAjaxResponder.php file... can you make it a PHP class so maybe people could extend it via XCLASS etc.? Right now it's just a bunch of random functions. Just check out the other modules and how they're coded.

All in all - very nice idea. I'm gonna try it out soon and send you some more recommendations.

Actions #3

Updated by Andreas Beutel over 16 years ago

Updated files as recommended. Since I'm unable to remove the old stuff, use the new files:

Patchfiles for index.php of shipped module (as of TYPO3 4.1.2 and SVN Trunk) and the additional required file (to be put in in typo3/mod/web/perms/).

Apply the provided patch file to your copy of TYPO3 4.1.2:
patch -p1 typo3/mod/web/perm/index.php < 20070828_t3_412_mod_web_perm_index.php.diff

Copy the additional files »mod_perm_ajax_responder.php« and »mod_perm.js« to »typo3/mod/web/perm/«

Actions #4

Updated by Benni Mack over 16 years ago

Hey Andreas. I sent you my updated js file. Make the changes addressed in my email and upload your new files here. I'll delete the old files then. We're getting closer... :-)

Actions #5

Updated by Andreas Beutel over 16 years ago

Implemented the recommended changes by Benjamin (thanks!)

- updated the javascript file
- added methods to toggle the admin-only editlock for each record

To test apply the provided patch file to your copy of TYPO3 4.1.2:
patch -p1 typo3/mod/web/perm/index.php < 20070901_t3_412_mod_web_perm_index.php.diff

Copy the additional files »20070901_mod_perm_ajax_responder.php« and »20070901_mod_perm.js« to »typo3/mod/web/perm/« and rename them »mod_perm_ajax_responder.php« and »mod_perm.js«.

Please note: The PHP code requires PHP5, otherwise you'll get errors or a blank page.

Actions #6

Updated by Andreas Beutel over 16 years ago

Provided PHP4 compatible files.

20070903_t3_412_mod_web_perm_index.php4.diff
20070903_mod_perm_ajax_responder.php4

You may use both files (apply the patch, rename the other file) as already described.

Actions #7

Updated by Benni Mack over 16 years ago

Hey Andreas,

as I told you, the only concern for me is the error handling. But let me see what I can do (I'm working on something right now to fix this issue) and will come back to that bug in the next days.

Actions #8

Updated by Benni Mack over 16 years ago

Hey Andreas,

sorry for the delay. Could you make one big patch file with all the changes? or a zipfile is fine too. I have lost track of what is needed anymore. Sorry!

Actions #9

Updated by Andreas Beutel over 16 years ago

Hi Benjamin,

find attached a new ZIP file (T3_413_mod_perm.zip) including all required files, the diff and a little ReadMe about the installation ;-)

Andreas

Actions #10

Updated by Ingmar Schlecht over 16 years ago

I've deleted all files obsolete files, so I only left the last one.

Actions #11

Updated by Benni Mack about 16 years ago

Hey Andreas,

haven't forgotten about your patch. Can we change your patch so it uses the new ajax.php framework in the backend available in trunk?

Actions #12

Updated by Andreas Beutel about 16 years ago

Hi Benjamin,

I'll update my copy of the SVN trunk and see if I can provide a new patch quickly. I'll post the new files here.

Actions #13

Updated by Andreas Beutel about 16 years ago

Please find attached the new version for TYPO3 4.2 (based on SVN Revision 3236). Find a readme how to install and test included. If it's ok, i'll provide patch/diff against svn trunk.

Changed files: index.php (extened for AJAX and revised for PHP5)
New files: perm.js and class.sc_mod_web_perm_ajax.php

Install instructions for testing
--------------------------------------

1. Replace the folder "typo3/mod/web/perm" with the folder "perm" in here
2. You have to register the AJAX module in "t3lib/config_default.php": Add the line to the array $TYPO3_CONF_VARS[BE][AJAX] (arround line 190)

'SC_mod_web_perm_ajax::dispatch' => 'typo3/mod/web/perm/class.sc_mod_web_perm_ajax.php:SC_mod_web_perm_ajax->dispatch'

Actions #14

Updated by Benni Mack about 16 years ago

Hey Andreas,

cool stuff. A few remarks about your work:

I just had brief look in the JS file:

  • call your ajaxID 'SC_mod_web_perm_ajax::dispatch' as this is your AJAX id and you don't have to add the dispatch at every call
  • Either remove the onT3Error() callbacks and then remove the comma , after the onSuccess function (otherwise you'll get an error in IE) or fill the onT3Error with a message, which will be probably not quite trivial (labels in different languages etc)

For the PHP part I'd like to have a diff to see what has changed. A quick look in the dispatch function shows me this:

  • use } else { instead of

}
else {

  • These two lines could be moved before the switch-case stmt and then it's easier to follow (don't repeat yourself ;-))
    // Init TCEmain
    $tce = t3lib_div::makeInstance('t3lib_TCEmain');
    $tce->stripslashes_values = 1;

Other than that, please provide a diff and send it to the core list. I will then test it in practice. Thanks

Actions #15

Updated by Benni Mack about 16 years ago

Commited the attached patch to the 4.2 branch.

Actions

Also available in: Atom PDF