473,695 Members | 2,737 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
Nov 17 '05 #1
0 808

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

Similar topics

0
1259
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 access that attribute, but not for functions. I can't say 'chicken.printme()',
10
3726
by: Cezar | last post by:
Hello. How can simple emulating in IE this class ? ..example:hover{ border: 1px solid #696969; } Greets, Cezar.
2
2599
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
0
986
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 (this.myPrincipal, rule)) {
5
2257
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 ...
1
2095
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 xml:space attribute element example {
4
3706
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 tried AppDomain.CurrentDomain.SetThreadPrincipal(myIPrincipal)...with no luck.
0
897
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
1676
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 .. .. ..
7
3069
by: Rick | last post by:
With String.Format, if I have an incorrect number of args specified for a format string, compile fails. How can I implement similar design-time functionality for my own string functions?
0
8647
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 usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9129
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. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8864
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7681
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5842
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 into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4351
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4590
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
2285
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
1986
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.