471,337 Members | 1,194 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,337 software developers and data experts.

Emulating the [PrincipalPermissionAttribute ...] attribute

Hi,

I use the Enterprise Library, and the custom rule provider. A rule is check
with this piece of code:

public void HireEmployee (....) {
string rule = "Hire Employee";
// The next line fetch the rule definition in a config file, and checks
it with the role the object "myPrincipal" belongs to.
if (! this.ruleProvider.Authorize (this.myPrincipal, rule)) {
MessageBox.Show ("Youe are not authorise to hire en employee");
return;
}
... // plenty of interesting lines
}
__________________________________________________ __________________________
____
I would like to have this style of code:
[PrincipalRuleAttribute Name="Hire Employee"]
public void HireEmployee (....) {

... // plenty of interesting lines
}

In that case, if a call is made to "HireEmployee", a security exception is
thrown...

I know only the basics of the Attribute class, and I don't really see what
to do...

Oriane
Jul 21 '05 #1
0 927

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

reply views Thread by Kamilche | last post: by
10 posts views Thread by Cezar | last post: by
2 posts views Thread by Bart | last post: by
5 posts views Thread by Stephan Schaem | last post: by
4 posts views Thread by =?Utf-8?B?QkogU2FmZGll?= | last post: by
reply views Thread by rosydwin | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.