Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. Setting users access permissions on tabs in C# tabcontrol

Setting users access permissions on tabs in C# tabcontrol

Scheduled Pinned Locked Moved C#
csharphelp
9 Posts 3 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • X Offline
    X Offline
    Xonel
    wrote on last edited by
    #1

    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

    M 1 Reply Last reply
    0
    • X Xonel

      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

      M Offline
      M Offline
      Mycroft Holmes
      wrote on last edited by
      #2

      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

      X L 2 Replies Last reply
      0
      • M Mycroft Holmes

        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

        X Offline
        X Offline
        Xonel
        wrote on last edited by
        #3

        Good Idea.. Thank you, but where do i write the conditional statement? Just a little illustration please

        M 1 Reply Last reply
        0
        • M Mycroft Holmes

          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

          L Offline
          L Offline
          Lost User
          wrote on last edited by
          #4

          That would be a security-leak; one can re-enable the tab with ManagedSpy[^].

          Bastard Programmer from Hell :suss:

          M 1 Reply Last reply
          0
          • X Xonel

            Good Idea.. Thank you, but where do i write the conditional statement? Just a little illustration please

            M Offline
            M Offline
            Mycroft Holmes
            wrote on last edited by
            #5

            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

            1 Reply Last reply
            0
            • L Lost User

              That would be a security-leak; one can re-enable the tab with ManagedSpy[^].

              Bastard Programmer from Hell :suss:

              M Offline
              M Offline
              Mycroft Holmes
              wrote on last edited by
              #6

              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

              L 1 Reply Last reply
              0
              • M Mycroft Holmes

                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

                L Offline
                L Offline
                Lost User
                wrote on last edited by
                #7

                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:

                M 1 Reply Last reply
                0
                • L Lost User

                  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:

                  M Offline
                  M Offline
                  Mycroft Holmes
                  wrote on last edited by
                  #8

                  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

                  L 1 Reply Last reply
                  0
                  • M Mycroft Holmes

                    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

                    L Offline
                    L Offline
                    Lost User
                    wrote on last edited by
                    #9

                    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:

                    1 Reply Last reply
                    0
                    Reply
                    • Reply as topic
                    Log in to reply
                    • Oldest to Newest
                    • Newest to Oldest
                    • Most Votes


                    • Login

                    • Don't have an account? Register

                    • Login or register to search.
                    • First post
                      Last post
                    0
                    • Categories
                    • Recent
                    • Tags
                    • Popular
                    • World
                    • Users
                    • Groups