[opencms-dev] setting module access permissions

Jorg Heymans jh at coeno.com
Mon Nov 4 10:34:38 CET 2002


Hi all,

I've created a few modules in opencms and am having some troubles setting the 
accesspermissions for these modules. Opencms provides a few hooks that can be 
set so that the module icon is not shown/active based upon certain 
conditions. I have defined a method in my contentdefinitionclass as 
following:

	public static Boolean isVisible(
		CmsObject cms,
		CmsXmlLanguageFile lang,
		Hashtable parameters)
		throws CmsException {
	
	
	//logic to determine userrights

	//logic to determine the type of project
	CmsRequestContext reqCont = cms.getRequestContext();
	if (reqCont.currentProject().getId() == cms.onlineProject().getId()) {
		return new Boolean(false);
	}
}

I then set the "visiblemethod" and "activemethod" property on the module 
folders to the method call in my contentdefinition class.

The method gets called fine when the project is selected in which my module 
resides, no probs there. However when the user selects the "Online" project 
this method doesn't get called anymore and all users can see all modules. 

I digged through the opencms source for similar functionality and found that 
the HTMLGallery module does something similar with more success, the module 
is blended out in the online project. 

What methods do i need to implement so that this works ? Any thoughts ? Other 
ideas to do this ?

Kind Regards
Jorg Heymans




More information about the opencms-dev mailing list