This topic is locked

Welcome page event code

4/15/2019 6:32:48 AM
ASPRunner.NET General questions
D
DCherrington author

Here is some code I am using on the Before displayevent on the Welcome page to show or hide tiles on the welcome page according to the access level I grant to users.

string strSQLExists = "select * from dbo.tblUser where AccessID IN (1,2) AND UserName = '" + XSession.Session["UserID"].ToString() + "'";

XVar rsExists = CommonFunctions.db_query(strSQLExists, null);

XVar data = CommonFunctions.db_fetch_array(rsExists);
if(data)

{

//List all welcome_group objects here

pageObject.showItem("welcome_group_quality");

pageObject.showItem("welcome_group_IPC");
//List all welcome_item objects here

pageObject.showItem("welcome_item_NEWS2");

pageObject.showItem("welcome_item_ANTT");

}

else

{

//List all welcome_group objects here

pageObject.hideItem("welcome_group_quality");

pageObject.hideItem("welcome_group_IPC");
//List all welcome_item objects here

pageObject.hideItem("welcome_item_NEWS2");

pageObject.hideItem("welcome_item_ANTT");

}


The problem with this solution is that when I add more list pages to the project, I will need to add more rows to the event code for each one.
Does anyone know if there are any easier solutions that will show/hide all items within a welcome_group object, or perhaps enable me to loop through all item objects within a group object?

admin 4/15/2019

You can restrict access to certain items via User Group Permissions. These settings will be applied to both main menu and welcome page.

D
DCherrington author 4/15/2019



You can restrict access to certain items via User Group Permissions. These settings will be applied to both main menu and welcome page.


My project is using Active Directory for user login, but I maintain a separate access table that I can easily modify user access permissions. I do it this way as it's simpler and quicker than asking the IM&T department to create and modify an Active Directory group in order to assign group permissions as you say.
That's why I'm doing this using the code on the event.
Is there an alternative?

admin 4/15/2019

No, there is no alternative to this.

jadachDevClub member 4/15/2019



My project is using Active Directory for user login, but I maintain a separate access table that I can easily modify user access permissions. I do it this way as it's simpler and quicker than asking the IM&T department to create and modify an Active Directory group in order to assign group permissions as you say.
That's why I'm doing this using the code on the event.
Is there an alternative?


Maybe something here will help

https://asprunner.com/forums/topic/23838-database-security-with-windows-authentication/