Author: sdumitriu
Date: 2008-02-21 14:37:42 +0100 (Thu, 21 Feb 2008)
New Revision: 7900
Modified:
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
Log:
XWIKI-2136: PluginAPI#getPlugin should always require programming rights, and
provide an getInternalPlugin methods for in-java usage
Also backported to the 1.1 and 1.2 branches.
Merged from [EMAIL PROTECTED]
Modified:
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
===================================================================
---
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
2008-02-21 12:55:52 UTC (rev 7899)
+++
xwiki-platform/core/branches/xwiki-core-1.1/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
2008-02-21 13:37:42 UTC (rev 7900)
@@ -52,10 +52,26 @@
* Return the inner plugin object, if the user has the required
programming rights.
*
* @return The wrapped plugin object.
- * @todo Why is this public and doesn't require programming rights?
*/
public XWikiPluginInterface getPlugin()
{
+ if (hasProgrammingRights()) {
+ return plugin;
+ }
+ return null;
+ }
+
+ /**
+ * Return the inner plugin object. This method is only for the plugin
API's internal use, and
+ * should not be exposed to scripting languages. It is an XWiki practice
to expose all the
+ * functionality using an API, and allow access to the internal objects
only to users with
+ * Programming Rights.
+ *
+ * @return The wrapped plugin object.
+ * @since 1.3RC1
+ */
+ protected XWikiPluginInterface getInternalPlugin()
+ {
return plugin;
}
Modified:
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
===================================================================
---
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
2008-02-21 12:55:52 UTC (rev 7899)
+++
xwiki-platform/core/branches/xwiki-core-1.2/xwiki-core/src/main/java/com/xpn/xwiki/plugin/PluginApi.java
2008-02-21 13:37:42 UTC (rev 7900)
@@ -52,10 +52,26 @@
* Return the inner plugin object, if the user has the required
programming rights.
*
* @return The wrapped plugin object.
- * @todo Why is this public and doesn't require programming rights?
*/
public XWikiPluginInterface getPlugin()
{
+ if (hasProgrammingRights()) {
+ return plugin;
+ }
+ return null;
+ }
+
+ /**
+ * Return the inner plugin object. This method is only for the plugin
API's internal use, and
+ * should not be exposed to scripting languages. It is an XWiki practice
to expose all the
+ * functionality using an API, and allow access to the internal objects
only to users with
+ * Programming Rights.
+ *
+ * @return The wrapped plugin object.
+ * @since 1.3RC1
+ */
+ protected XWikiPluginInterface getInternalPlugin()
+ {
return plugin;
}
_______________________________________________
notifications mailing list
[email protected]
http://lists.xwiki.org/mailman/listinfo/notifications