Extending/Modifying Orchard.Users module

Topics: Administration, Core, Customizing Orchard
Oct 28, 2014 at 12:19 PM
Hi,

In the application we are developing we need to modify Orchard.Users module in the following way:
1) In the Dashboard -> Users we need to inject new actions for the account

2) When user is deleted from Dashboard -> Users, we need to capture that event and influence execution of the Orchard.Users.AdminController.Delete HttpPost action based on what happens in the event.

Current ideas (we are thinking about this, we haven't implemented anything yet):
1) Rewrite AdminController.Index action to use shapes for each user account. Define an "Actions" zone in user shape and inject actions via Placement.info. Currently, plain cshtml is used.
  • Currently we are hijacking the route from Orchard.Users with another one of higher priority.
2) Extend IUserEventHandler with two new events Deleting and Deleted. These events will return an object. Values of the properties of that object will influence execution of the HttpPost Delete action.
  • Currently, we are using Handler to achieve a partial result, but we can't influence execution of Delete action from Handler.
What would be the recommended way to do this? Are we thinking in the right direction?
Nov 6, 2014 at 10:04 AM
Bump.

Nobody has any recommendations?
Developer
Nov 6, 2014 at 6:41 PM
I would implement whatever I can using IUserEventHandler where it makes sense. If I had to customize the user list screen, I would see what it would take to make it customizable and create an issue for this (if for example all you need is the list of actions to be a zone into which you want to render custom actions), keeping in mind that the changes I make should be generic enough so that it makes sense for the rest of the community. Meanwhile I would create a fork, implement it myself, and send a pull request as part of the issue. If rejected, I would copy the code into my own module and give my route a higher priority and delete the fork.

Hope this helps.
Marked as answer by tancev on 11/7/2014 at 12:09 AM
Nov 7, 2014 at 8:10 AM
sfmskywalker wrote:
I would implement whatever I can using IUserEventHandler where it makes sense. If I had to customize the user list screen, I would see what it would take to make it customizable and create an issue for this (if for example all you need is the list of actions to be a zone into which you want to render custom actions), keeping in mind that the changes I make should be generic enough so that it makes sense for the rest of the community. Meanwhile I would create a fork, implement it myself, and send a pull request as part of the issue. If rejected, I would copy the code into my own module and give my route a higher priority and delete the fork.

Hope this helps.
Thank you very much. Your reply is very helpful.