473,568 Members | 3,148 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Emulating the [PrincipalPermis sionAttribute ...] 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 "myPrincipa l" belongs to.
if (! this.ruleProvid er.Authorize (this.myPrincip al, 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:
[PrincipalRuleAt tribute Name="Hire Employee"]
public void HireEmployee (....) {

... // plenty of interesting lines
}

In that case, if a call is made to "HireEmploy ee", 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 980

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
1256
by: Kamilche | last post by:
""" Emulating Python inheritance manually. By loading it from disk at run time, you can create new custom types without programmer intervention, and reload them on demand, without breaking anything. The only time programmer intervention is required, is when new functions are added. It works well for data... I can use 'chicken.color' to...
10
3712
by: Cezar | last post by:
Hello. How can simple emulating in IE this class ? ..example:hover{ border: 1px solid #696969; } Greets, Cezar.
2
2593
by: Bart | last post by:
Hi there, Since you've all told me that frames ar evil, I'm planning to disguard frames in favour of CSS "pseudo-frames" for my personal website. While trying to "emulate frames" (that is I want a 2 column layout, with the menu in the left column) I came up with this: http://home-1.tiscali.nl/~knmg0017/css_frames_1.htm
5
2248
by: Stephan Schaem | last post by:
How does one write an unmanaged function that perform this functionality? In short I want to turn off/on visual style in my app... Thanks, Stephan PS: two people have been looking for some time, and no solution aside putting the manifest in a file, and renaming the file before startup was found... very ugly hack ...
0
804
by: Oriane | last post by:
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...
1
2090
by: jiffers | last post by:
I'm trying to figure out how to define an element in RNC so that its contents are validated if a definition matches, othewise no validation is done. The example given in the tutorial seems to indicate that you need to exclude by enumeration all defined attributes and elements: #this validates all attributes loosely, except for the defined...
4
3700
by: =?Utf-8?B?QkogU2FmZGll?= | last post by:
I am reposting this for a colleague because he has had some problems setting up his subscriber Nospam alias: I am having problems unit testing a method which is decorated with the attribute. I always get a security exception. I have set the Thread.CurrentPrincipal to my custom IPrincipal.IsInRole method never gets called I have even...
0
896
by: xamman | last post by:
hello! anyone ever manage to do this? after trying nearly everything i can think of my code (below) still gives 'request for principal permissions failed' . many thanks
3
1670
by: xamman | last post by:
hello! anyone ever manage to do this? after trying nearly everything i can think of my code (below) still gives 'request for principal permissions failed' . many thanks x .. .. ..
0
7692
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main...
0
7913
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
8117
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
0
7962
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6274
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5496
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
5217
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert...
1
1207
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
931
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.