Apr 11, 2012 at 12:30 AM
Edited Apr 11, 2012 at 12:41 AM
In my custom module, I've overridden the IMembershipService, IAuthorizationService, and IAuthenticationService to use a pre-existing user database (see
http://orchard.codeplex.com/discussions/262962). Apart from some transaction scoping issues (see http://orchard.codeplex.com/discussions/350250),
this seems to have worked pretty well.
In fact, the only thing that it seems to have broken is the Owner field in the Content editor. The issue there is this: when I'm editing the page, I have to re-specify the Owner every time, and of course, it doesn't get saved to the database (or rather,
it gets saved as a "0" to the [Common_CommonPartRecord].[OwnerId] column). So the next time I pull up the page, the Owner is blank again. Even specifying an existing UserId (e.g., "admin") doesn't seem to work.
This isn't the end of the world, because it's not too difficult to type it back in every time, but it is a bit annoying (especially for non-techie folks who want to administer their own pages - which is sorta the point), and I worry that eventually we'll
actually want to identify the owner of page A or projection B.
So does anyone have any suggestions for the best way to handle this? None of the options I can think of sound too palatable, but for the record they include:
- Synchronize the external user database with Orchard somehow.
- Give up on the idea of using the Orchard security infrastructure with my custom module (and figure out a way to handle it in a way that's completely internal to my module).
- Figure out how to get the UserPartRecord to talk to my external user database. (Not sure if this is at all possible, of if so, how to get it to happen.)
- Override the OwnerEditorDriver to set the owner to "admin" if it's not already set.
- Hack (or override?) the OwnerEditorViewModel and remove the [Required] attribute.
Other suggestions? Like I said, none of these sound terribly palatable, but perhaps some will be easier or have fewer side-effects than I think.