Security Question

Security Question

Old forum URL: forums.lhotka.net/forums/t/1058.aspx


CSlaughter posted on Tuesday, August 29, 2006

I'm developing an application that has two roles ("Admins" and "Guest").  Guest can create an account to become a member.  My requirements are:
  1. Admins can edit any members information
  2. A member is allowed to update only his/her information
  3. Guest can read any member's information
So my thought is once a member logins I can load the members ID (GUID) as a role and then do something like Csla.ApplicationContext.User.IsInRole(Member.ID.tostring) in the Authorization Rules section to check if the user can edit the selected Member object.  Does this sound correct?

figuerres replied on Tuesday, August 29, 2006

CSlaughter:
I'm developing an application that has two roles ("Admins" and "Guest").  Guest can create an account to become a member.  My requirements are:
  1. Admins can edit any members information
  2. A member is allowed to update only his/her information
  3. Guest can read any member's information

So my thought is once a member logins I can load the members ID (GUID) as a role and then do something like Csla.ApplicationContext.User.IsInRole(Member.ID.tostring) in the Authorization Rules section to check if the user can edit the selected Member object.  Does this sound correct?

 

#3 -- Id say a guest can read only a select part of members info... not all the data!

normaly the members roles will be in a seperate table and not based on the ID
what I would do is this:

create a role named "Guest"

when you allow a user to "Self Create" assign them the Guest Role.

then go from there.... let an Admin edit the users roles to include other roles and take them out of Guest.

Edit /  Update:  just have a bit of logic that allows a user to edit thier data but not the roles they are assigned to.

if (User.ID=SelectedUser.ID) and (NOT inRole("Guest"))

-- Edit my stuff

else

 -- sorry guest you are not permited -- talk to an admin.

 

CSlaughter replied on Tuesday, August 29, 2006

Thanks for the quick reply.  Regarding the (User.ID = SelectedUser.ID), would User be a new class? I'd like to use the existing Identity class so I guess I could modify it to have a new property for ID.  Sound good?

Copyright (c) Marimer LLC