File Module / Menu Buttons based on Group Membership

Post modules, themes or any other code you want to share with the community.

Moderator: Developers

jbergsma
Posts: 2
Joined: Mon Feb 28, 2011 9:13 am

File Module / Menu Buttons based on Group Membership

Postby jbergsma » Mon Feb 28, 2011 9:43 am

Hi Guys,

I try to write a small addon on the file module.

Hiding action buttons in the menu for "normal" users.

I know menu buttons for the file module are created in FileBrowser.js and there is already a config.hideActionButtons which can be used.

How can i read the group of the user who logs on in FileBrowser.js?

Something like:
If (!config.groupmember == "Admins")
{
config.hideAntionButtons=true;
}
mschering
Site Admin
Site Admin
Posts: 8154
Joined: Tue Apr 20, 2004 1:06 pm
Location: The Netherlands - Den Bosch
Contact:

Re: File Module / Menu Buttons based on Group Membership

Postby mschering » Tue Mar 01, 2011 8:08 am

The best approach is to write a module:

http://www.group-office.com/wiki/Customizations

Then in plugin.js put something like:

Code: Select all

GO.moduleManager.onModuleReady('files',function(){
   Ext.override(GO.files.FileBrowser, {
      initComponent : GO.files.FileBrowser.prototype.initComponent.createSequence(function(){
         if(GO.settings.has_admin_permission)
            this.getTopToolbar.setDisabled(true);

      })
   });
});


Not sure if this code works though. Just wrote it down without testing.
Best regards,

Merijn Schering
Intermesh
jbergsma
Posts: 2
Joined: Mon Feb 28, 2011 9:13 am

Re: File Module / Menu Buttons based on Group Membership

Postby jbergsma » Tue Mar 01, 2011 11:49 am

Thanx Merijn,

GO.settings.has_admin_permission did the trick for me :D

Return to “Contributed development”

Who is online

Users browsing this forum: No registered users and 1 guest

cron