Sunday, May 25, 2008

MVC.Net update

Greetings


Just an update to let you know that I am still very active with the MVC.NET and LINQ SQL stuff, its just that there hasn't been anything terribly new to report. I continue to use LINQ SQL for everything, even where it feels incorrect.


I added a bunch of permissions. They are represented as, basically, name value pairs. There isn't a table storing these permissions yet; there's just a view that infers the permissions.


Whoever creates a clan becomes the clan owner.

Whoever creates a family becomes the family owner.

Clan owners can edit their clans, the family in their clans, and the people in their family.

Family owners can edit their family, and the people in their family.

People can edit themselves.


Those rules are all brought together in a view. I have a permissions class with three properties: People, Clan, Family. Each of those subclasses has a property or method to represent the permission from the database. The properties/methods are really for convenience. If there isn't a property for a particular permission, there's a method that you call to pass the parameters.


The permissions are setup as



ObjectType - People, Clan, Family
ObjectId - PeopleId or ClanId or FamilyId
Objectname - Clan Name, Family Name, or People Id
User Name
Permission Name


IE:

Clan, 33, 'Jay and Gina', 'Jay', 'CanAddPeopleToFamily'



I have a static reference to an instance of the permissions class. It uses a ReaderWriterLockSlim to wrap up the reader methods and the load method. Each time a family or clan is created, the permissions cache is reloaded.


That's really a brute force approach, and its definitely temporary. The permissions should be lazy loaded per-object-per-user.


I built it so that families can belong to multiple clans. When you create a new clan, it gives you the option of bringing existing families to the new clan. That's going to need an approval process... maybe the family doesn't want to be copied. At the very least, they need the flexibility to decide for themselves.

The more I use MVC.NET, the more I think that it really needs a mapping layer. That may be an ill-informed opinion, but so far, that's what I've come up with. I have the MEMBERSHIP controller redirecting the the HOME controller after logging in. That should be configurable at some other level. I'm thinking about writing that level to test it out. We'll see.

No comments: