[xwiki-devs] edit right and addobject
I use the addObject method to create new annotation, my plugin. When a user submit the form to add an annotation, i call addObject('annotationClass') . But, to invoke this method, user might have the edit right. And i'd like to have possibility to annotate with only comment right. How to create a method addAnnotation that need only comment right to be called? Thank for your time. Antoine
antoine seilles wrote:
I use the addObject method to create new annotation, my plugin. When a user submit the form to add an annotation, i call addObject('annotationClass') . But, to invoke this method, user might have the edit right. And i'd like to have possibility to annotate with only comment right.
How to create a method addAnnotation that need only comment right to be called?
Thank for your time.
Antoine
1. Add a new Action (com.xpn.xwiki.web.AnnotationAction). You can adapt it from Comment 2. In <webapp-root>/WEB-INF/struts-config.xml add the AnnotationAction and map it to /annotate/ 3. In com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl#getRight add: actionMap.put("annotate", "comment"); 4. Compile the modified XWikiRightServiceImpl and either replace the existing class from xwiki-core-*.jar, or put it in <webapp-root>/WEB-INF/classes/com/xpn/xwiki/user/impl/xwiki/ Or you can just rebuild the whole xwiki-core. That's a lot of changes, and I don't like it. This is why I'd like to be able to: - Hook rights from plugins, without having to change and recompile core classes - Add actions without having to change struts-config.xml -- Sergiu Dumitriu http://purl.org/net/sergiu/
Sergiu Dumitriu a écrit :
antoine seilles wrote:
I use the addObject method to create new annotation, my plugin. When a user submit the form to add an annotation, i call addObject('annotationClass') . But, to invoke this method, user might have the edit right. And i'd like to have possibility to annotate with only comment right.
How to create a method addAnnotation that need only comment right to be called?
Thank for your time.
Antoine
1. Add a new Action (com.xpn.xwiki.web.AnnotationAction). You can adapt it from Comment 2. In <webapp-root>/WEB-INF/struts-config.xml add the AnnotationAction and map it to /annotate/ 3. In com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl#getRight add: actionMap.put("annotate", "comment"); 4. Compile the modified XWikiRightServiceImpl and either replace the existing class from xwiki-core-*.jar, or put it in <webapp-root>/WEB-INF/classes/com/xpn/xwiki/user/impl/xwiki/ Or you can just rebuild the whole xwiki-core.
That's a lot of changes, and I don't like it. This is why I'd like to be able to: - Hook rights from plugins, without having to change and recompile core classes - Add actions without having to change struts-config.xml
I'd like to not have to change the core. Thank for your help -- Antoine SEILLES Doctorant (phd student) Pikko software et LIRMM CNRS Président de l'association imagiLAB Pikko software: Cap Omega - Rond Point Benjamin Franklin CS 39521 34960 Montpellier Cedex 2 FRANCE http://www.pikko-software.com LIRMM CNRS: UMR 5506 - 161 rue Ada 34392 Montpellier Cedex 5 FRANCE http://www.lirmm.fr imagiLAB apt D22 Mas du Cavalier, 365 quai louis le vau 34080 Celleneneuve www.imagilab.fr Tel: +33 (0)6 10 192 055 [email protected] [email protected] [email protected] [email protected]
1. Add a new Action (com.xpn.xwiki.web.AnnotationAction). You can adapt it from Comment
I createdd a new Action com.xpn.xwiki.AnnotationAddAction adapted from CommentAddAction And i did all the others steps but i have an error when calling my method: java.lang.NoSuchMethodError I have few questions about this method: * isResponseCorrect = captchaPluginApi.verifyCaptcha("param"); What should be referenced by "param"? * I have substituated BaseClass baseclass = xwiki.getCommentsClass(context); by BaseClass baseclass = xwiki.getClass("XWiki.AnnotationClass", context); * xwiki.saveDocument(doc, context.getMessageTool().get("param"),true,context); Again, What should be referenced by "param"?
2. In <webapp-root>/WEB-INF/struts-config.xml add the AnnotationAction and map it to /annotate/ 3. In com.xpn.xwiki.user.impl.xwiki.XWikiRightServiceImpl#getRight add: actionMap.put("annotate", "comment"); 4. Compile the modified XWikiRightServiceImpl and either replace the existing class from xwiki-core-*.jar, or put it in <webapp-root>/WEB-INF/classes/com/xpn/xwiki/user/impl/xwiki/ Or you can just rebuild the whole xwiki-core.
That's a lot of changes, and I don't like it. This is why I'd like to be able to: - Hook rights from plugins, without having to change and recompile core classes - Add actions without having to change struts-config.xml
-- Sergiu Dumitriu http://purl.org/net/sergiu/ _______________________________________________ devs mailing list [email protected] http://lists.xwiki.org/mailman/listinfo/devs
Thank for your time
participants (3)
-
antoine seilles -
antoine SEILLES -
Sergiu Dumitriu