Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Modifying Schedule.csp page 1

Status
Not open for further replies.

jrennatc

Programmer
Aug 12, 2004
37
US
There was a previous post on how to modify the schedule.csp page to restrict access to scheduling reports by userid. Does anyone know the appropriate syntax for the csp page to reference a user group. We run reports out of our productions system and we want to restrict users in particular groups from running any reports during business hours.

Apparently, this is the code to restrict by Administrator userid.
iStore.EnterpriseSession.UserInfo.UserId == 12


 
This query (from CE9) should be helpful. If more detail is needed, please ask.

Code:
SELECT SI_ID, SI_NAME FROM CI_SYSTEMOBJECTS WHERE SI_PROGID = 'CrystalEnterprise.UserGroup'
 
mdwyer,

I can use that query, but I need to know the usergroups associated with the user that is logged in. I've gotten this far:

//Get the userid
var userid = iStore.EnterpriseSession.UserInfo.UserId;

//Get an InfoObject collection that contains the user
var Result = iStore.Query("Select * From CI_SYSTEMOBJECTS Where SI_PROGID='CrystalEnterprise.USER' And SI_ID ='" + userid + "'");
var User = Result.Item(1);

//Get the user's Group collection.
var Groups = User.PluginInterface ("").Groups;
Response.Write ("Group Count: "+ Groups.count+ "<br>");

for (k = 1; k <= Groups.count; k++)
{ if (Groups.Item(k).SI_ID ==1450 || Groups.Item(k).SI_ID ==17611||Groups.Item(k).SI_ID ==299)
{
usergroup = "Vantive";
}
else if (Groups.Item(k).SI_ID == 2)
{
administrator = "Administrator";
}
Response.Write("Counter: "+ k + "<br>")

}

I'm getting the right count of groups and my loop structure is successfully looping through the groups, but Groups.Item(k).SI_ID is returning an "undefined".
Any idea how to reference the group_id in this fashion?

Thanks in advance for the help!
 
Is this where the 'undefined' is being returned?

if (Groups.Item(k).SI_ID ==1450 || Groups.Item(k).SI_ID ==17611||Groups.Item(k).SI_ID ==299)

Try this instead and let me know the result:

if (Groups(k) ==1450 || Groups(k) ==17611||Groups(k) ==299)
 
I was outputting the value to the screen which was not shown in the code snippet I gave you. Your solution solved my problem, Thanks!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top