How to Temporarily/Programmatically Disable Edit/Create rights for a user

The need for this has a lot to do with the Parent/Child way permissions are set up. i.e. Rights for Page and Children. (By the way - it makes my brain hurt the way xwiki does it)

For example - lets say that you have an app - CustomerComplaints.WebHome, and the (parent) page contains the logic to add the sub pages (yeada yeada). The App, stores its pages under the WebHome -

CustomerComplaints.Comp3 etc…

The rights Can (and should) be set on the “Rights Page and Children” to view/edit. However, the rights also have to be set on the “Rights Page” for the parent to disable Edit. This is necessary so that people cant modify the app (Parent Page)

There are several problems (headaches) with this.

  • On the App (Parent) This doesn’t disable the Create Button - We have to use $disableContentMenu - This can be overridden by just forcing the URL anyway
  • While group permissions can be given to the user to create the page - we don’t necessarily want them to edit them. Or unless they perform some task or something like they have to check a box that they got mommys permission or something.

as far as I can tell, there is no way to (on the Edit Sheet of the class) to have something like… #If ($mommySaidOk == false) $hasEdit = false

It would be much simpler to give the permissions to the (app) Page & Children, Add some code to the app ( ex: $denyEdit = true and $denyCreate = true)

Please let me know if I can programatically take away a users rights for a page (please note that this isn’t about back-door adding rights ( I can see why that would be bad) this is about temporally disabling rights the user has based on actions . Somehow?

Thanks All!