Setting users access permissions on tabs in C# tabcontrol
-
Hi I have a desktop C# application that is basically built on Tab control. I have 8 tabs and i need to have different domains to be selected(e.g Admin, clerk, bursar, secretary) on my login where when a user under a specific domain clicks on a certain tab, an event is generated that prevents him from viewing the content of that tab. I was thinking of it this way...
private void Form1\_Load(object sender, EventArgs e) { if ((Thread.CurrentPrincipal.IsInRole("admin"))) // admin in this case should be a domain name. { tabPage4.Hide(); } else { MessageBox.Show("You must be a member of the Manager or Administrator's roles to view username and password information", "Insufficient Permissions", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
But now instead of
CurrentPrincipal.IsInRole
put something that will read the domain name. Something of that sort. I'll appreciate any help Thank you
-
Hi I have a desktop C# application that is basically built on Tab control. I have 8 tabs and i need to have different domains to be selected(e.g Admin, clerk, bursar, secretary) on my login where when a user under a specific domain clicks on a certain tab, an event is generated that prevents him from viewing the content of that tab. I was thinking of it this way...
private void Form1\_Load(object sender, EventArgs e) { if ((Thread.CurrentPrincipal.IsInRole("admin"))) // admin in this case should be a domain name. { tabPage4.Hide(); } else { MessageBox.Show("You must be a member of the Manager or Administrator's roles to view username and password information", "Insufficient Permissions", MessageBoxButtons.OK, MessageBoxIcon.Exclamation); } }
But now instead of
CurrentPrincipal.IsInRole
put something that will read the domain name. Something of that sort. I'll appreciate any help Thank you
Why do you make it so complicated, I would manage the visibility based on the users group. If they don't have permission then don't show the tab or disable the tab.
Never underestimate the power of human stupidity RAH
-
Why do you make it so complicated, I would manage the visibility based on the users group. If they don't have permission then don't show the tab or disable the tab.
Never underestimate the power of human stupidity RAH
-
Why do you make it so complicated, I would manage the visibility based on the users group. If they don't have permission then don't show the tab or disable the tab.
Never underestimate the power of human stupidity RAH
-
Good Idea.. Thank you, but where do i write the conditional statement? Just a little illustration please
In the form load method you check the current users credentials and set the visibiility/disable the tabs according to the users creds.
Never underestimate the power of human stupidity RAH
-
That would be a security-leak; one can re-enable the tab with ManagedSpy[^].
Bastard Programmer from Hell :suss:
If any of my users are capable of using such a tool and are caught circumventing an applications security I will get them fired. I write corporate software not highly secure commercial applications. It is assumed that if you work for the organisation you abide by their ethics and rules, you don't try and hack the solutions we supply to make your life simpler!
Never underestimate the power of human stupidity RAH
-
If any of my users are capable of using such a tool and are caught circumventing an applications security I will get them fired. I write corporate software not highly secure commercial applications. It is assumed that if you work for the organisation you abide by their ethics and rules, you don't try and hack the solutions we supply to make your life simpler!
Never underestimate the power of human stupidity RAH
Mycroft Holmes wrote:
I write corporate software not highly secure commercial applications.
I was under the assumption that those are the same; If you trust your users, then why go through the bother of hiding it at all? Getting fired might not be that much of a punishment, if someone is being paid by the competition to destroy the database. ..and it might be "hard" to catch them circumventing security. Call me paranoid.
Bastard Programmer from Hell :suss:
-
Mycroft Holmes wrote:
I write corporate software not highly secure commercial applications.
I was under the assumption that those are the same; If you trust your users, then why go through the bother of hiding it at all? Getting fired might not be that much of a punishment, if someone is being paid by the competition to destroy the database. ..and it might be "hard" to catch them circumventing security. Call me paranoid.
Bastard Programmer from Hell :suss:
Eddy Vluggen wrote:
I was under the assumption that those are the same;
No they are vastly different, inside the firewall you have higher level of control over what the app does, in the wild the requirements will be dramatically wider and there is less tolerance of errors (not necessarily bugs). As to trusting the users, bloody hell no, but they do know hacking the systems carry a load of retribution, sacking being the least. If a user acquires a specialist peice of software who primary use is to circumvent the internal security of an app they are way outside the bounds of acceptable activity. They would need to be paid very well with a long term prospect of collecting.
Never underestimate the power of human stupidity RAH
-
Eddy Vluggen wrote:
I was under the assumption that those are the same;
No they are vastly different, inside the firewall you have higher level of control over what the app does, in the wild the requirements will be dramatically wider and there is less tolerance of errors (not necessarily bugs). As to trusting the users, bloody hell no, but they do know hacking the systems carry a load of retribution, sacking being the least. If a user acquires a specialist peice of software who primary use is to circumvent the internal security of an app they are way outside the bounds of acceptable activity. They would need to be paid very well with a long term prospect of collecting.
Never underestimate the power of human stupidity RAH
Mycroft Holmes wrote:
No they are vastly different, inside the firewall you have higher level of control
Someone might temporarily disable the firewall to diagnose connection-problems. Or buy a PC with a rootkit.
Mycroft Holmes wrote:
If a user acquires a specialist peice of software who primary use is to circumvent the internal security of an app they are way outside the bounds of acceptable activity. They would need to be paid very well with a long term prospect of collecting.
Provided you know which user it was, and that's assuming it's an employee.
Bastard Programmer from Hell :suss: