CodeCharge Studio
search Register Login  

Web Reports

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> Tips & Solutions

 Hide/Show panel according to Security Level/GroupID

Print topic Send  topic

Author Message
ckroon

Posts: 869
Posted: 10/28/2007, 11:12 AM

Snaps to Walter Kempees for showing me how to do this neat little bit of coding using a CASE statement.

I am developing a website that has areas for 10 different security levels, each with their own areas of access.

Instead of each of them having their own login-landing pages I wanted to create one login-landing page where the buttons that appear, (control panel), are the ones only for their security level.

Make your panels, set visibility to off and then put the following code in the BeforeShow event of the Page.

You can have several panels show up for a security level, or just one specific one. Totally customizable and scalable.

//start code

switch ( CCGetGroupID()) {
case 0: //userlevel = 0
$Component->Panelname1->Visible = True;
break;
case 1: //userlevel =1
$Component->Panelname1->Visible = True;
$Component->Panelname2->Visible = True;
break;
case 2: // userlevel 2 more rights, assumed
$Component->Panelname1->Visible = True;
$Component->Panelname2->Visible = True;
$Component->Panelname3->Visible = True;
break;
case 9: // even higher level
$Component->Panelname1->Visible = True;
$Component->Panelname2->Visible = True;
$Component->Panelname3->Visible = True;
$Component->Panelname4->Visible = True;
$Component->Panelname5->Visible = True;
$Component->Panelname6->Visible = True;
$Component->Panelname7->Visible = True;
$Component->Panelname8->Visible = True;
break;
}


//This is just a sample.



Notice the “break” it should be the last statement in each case construct.

Remember: All panels need to be visible False by default.

_________________
Walter Kempees...you are dearly missed.
View profile  Send private message
wkempees
Posted: 10/29/2007, 9:46 AM

  
   default : // all other (non captured) levels  
      $Component->Panelname1->Visible = True;  
      $Component->Panelname2->Visible = True;  
      $Component->Panelname3->Visible = True;  
      $Component->Panelname4->Visible = True;  
      $Component->Panelname5->Visible = True;  
      $Component->Panelname6->Visible = True;  
      $Component->Panelname7->Visible = True;  
      $Component->Panelname8->Visible = True;  

could be added just before the closing }
to execute for all not captured vaues


Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.