Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>I've done exactly this before and its no trivial implementation. You're going to want to look at the SecurityPermission class. </p> <p>[<a href="http://msdn.microsoft.com/en-us/library/system.security.permissions.securitypermission.aspx][1]" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.security.permissions.securitypermission.aspx][1]</a></p> <p>I have done this before by utilizing XML (which I'm not sure I'd do again) and storing that XML as permission list inside of SQL server in an XML column through a CLR stored proc. The XML would have an element called a "permission" and then the permission would actually be a ENUM inside of the code. Each permission was a new implementation of the SecurityPermission class (linked above) Users were tied to groups which were defined in SQL server and then as the user was added/removed to groups, the XML doc would get updated to reflect which groups they were apart of. </p> <p>As soon as the user logged in, the users credentials would be loaded into the application store (session) and then would be accessed accordingly. When authorization needed to take place the XMl in the application store would be pulled down loaded into the SecurityPermission via the "FromXML" method. At that point I would use the following methods to determine if the user had permission: </p> <ul> <li>Demand</li> <li>Intersect</li> <li>Union</li> <li>IsUnrestricted</li> <li>IsSubSetOf</li> </ul> <p>etc., etc, etc. </p> <p>At that point after performing the Demand I was able to determine if the caller had access according to how I implemented my security routines in the SecurityPermissions. </p> <p>Again, this is leaving out a TON of detail, but this should get you going down the right path. </p> <p>Take a look at this name space as well: [2]: <a href="http://msdn.microsoft.com/en-us/library/system.security.permissions.aspx" rel="nofollow noreferrer">http://msdn.microsoft.com/en-us/library/system.security.permissions.aspx</a> "System.Security.Permissions"</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload