On 05/17/2012 05:13 AM, mohit gupta wrote:
I am trying to execute below groovy script thru one of the UI Page

String xwikiUser = xwiki.getUser("Scott")//line1 executing
String wikiname = xwiki.getXWiki().clearName("Scott", true, true,
// other code which is also not executing

but line 2 never executes becoz i dont get control in clearName method.
After debugging it i found while
  xwiki.getXWiki() it checks whether user has  programming right  rights
which returns null. But i have explicitly given the admin user program
rights at
  wiki administartion level.

  For more debugging information control goes to  method i.e  public boolean
hasProgrammingRights(XWikiContext context) of xwikiAuthServiceImpl.java
  and line 3 returns false

  // Once dropPermissions has been called, the document in the
         // context cannot have programming permission.
         if (context.hasDroppedPermissions()) {

If the code enters here, it means that you're trying to execute code outside the page content, which isn't allowed. You should write a script service in Java that does all the restricted work, and then you can just call it from Velocity without programming rights.

             return false;//;line 3

Not getting how to give proper programming rights to admin user here?

Sergiu Dumitriu
users mailing list

Reply via email to