Search code examples
asp.netrolesmembership

ASP.net custom membership with group administrators


I'm looking to implement a membership system where there a several different levels of membership.

Something along the lines of:

  • Administrators
    • Bob
  • Organisations
    • Organisation members
      • Fred
  • Owners
    • Supporting users
      • Wilma

I'd like the Administrator to be able to add an organisation and from then on the person assigned to as the admin/owner of the organisation will be delegated the task of setting up membership/roles etc only within that sub-group (of course administrator would be able to override/change this as well)

So in this example Bob could add an organisation with fred as its administrator and fred could assign a new user say 'Thelma' as a member of his organisation.

From what I've seen this doesnt really seem to fit into the model of membership/roles that asp.net uses unless I'm thinking about it in the wrong way.

Is there a way to make this work with the inbuilt providers or would the best approach to be to ditch them and implement something custom?


Solution

  • You can keep the inbuilt providers and solve it with a relation between the organization and the membershipUser so you can say that a membershipUser "owns" an organization.

    After that, you have a membershipUser Foreign Key on your organization that you can use to query the organizations that a user owns.

    Shure you can implement a custom provider but it could take time to code and debug. I used the aproach I mention years ago and saved me from implementing the custom provider.