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 Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

testing for refesh permissions 1

Status
Not open for further replies.

MaddogC

Programmer
Dec 4, 2003
134
GB
Any idea how I can test if a user has 'refresh the report' permissions in code for CE 9?

If a user doesn't have permissions I want to redirect to another page.
 
Will a query to the APS database be enough of an answer for you? I'm guessing that information is accessible using the SDK if you're comfortable coding with it.
 
i'm doing the following in classic ASP, well csp

set Result = istore.query("select top 1 * from ci_infoobjects where SI_ID = '" & strReportID & "'")

and then

ReportInterface.ReportParameters.Count to test for paramters. I need to be able to do something similar to test for 'refresh the report', so that I can direct the page elsewhere if the user doesn't have permissions.
 
I'm sorry. I thought I was doing something similar enough to share some ideas, but I'm not. And I don't see the rights in the data model clearly enough to create a query.

This is the code I am using to display rights at the Folder level (folderObj is from the collection of 'CrystalEnterprise.Folder' in CI_INFOROBJECTS):

Code:
Function LimitsData( folderObj)
	Dim FolderSecInfo
	Dim ObjPrincipal
	Dim ObjPrLimits
	Dim Limit
	Dim pLoop	' Principal (outer) loop index
	Dim lLoop	' Limits (inner) loop index
	Dim pID
	Dim pName
	Dim LimDesc
	
   ' Get the security information for the Folder object.
	Set FolderSecInfo = folderObj.SecurityInfo

	' Loop through each "principal" (group or user) for the folder
	For pLoop = 1 to FolderSecInfo.ObjectPrincipals.Count
		pID = "#" & FolderSecInfo.ObjectPrincipals.Item(pLoop).ID
		pName = FolderSecInfo.ObjectPrincipals.Item(pLoop).Name

		' Get the folder (object) Limits for the current "principal"
		Set ObjPrincipal = FolderSecInfo.ObjectPrincipals.Item(pID)
		If Err.Number <> 0 Then
			Response.Write "<B>* Any-Principal Used *</B>"
			Set ObjPrincipal = FolderSecInfo.AnyPrincipal(1)
			Err.Clear
		End If
		Set ObjPrLimits = ObjPrincipal.Limits

		' Loop through the current principal's limits and display their information.
		For lLoop = 1 to ObjPrLimits.Count
		Response.Write pName & "</TD><TD>"
			Set Limit = ObjPrLimits.Item( lLoop)

			' Convert Limits to a "Delete Instances Over..." format
			LimDesc = Limit.Description
			If LimDesc = "Maximum instance age in days" then
				LimDesc = Limit.Value & " days old"
			Else If LimDesc = "Maximum instance count per object" then
				LimDesc = Limit.Value & " per object, in total"
			Else If LimDesc = "Maximum instance count per object, per user" then
				LimDesc = Limit.Value & " per object, per user"
			Else
				LimDesc = Limit.Description & ": " & Limit.Value
			End If
			End If
			End If
			Response.Write LimDesc		& "</TD><TD align='center'>"
			
'			Response.Write Limit.Description		& "</TD><TD align='center'>"
'			Response.Write Limit.Value				& "</TD><TD align='center'>"
			Response.Write Limit.UseMaximumValue	& "</TD><TD align='center'>"
			Response.Write Limit.Inherited	& " " ' w/o space, true/false displays as 0/-1
		Response.Write "</TD></TR><TR><TD></TD><TD></TD><TD></TD><TD>"	' set up for next row
		Next
	Next

My thought was that the SecurityInfo/ObjectPrincipals would be available at the Report level, but I don't know if it is.
 
Nearly there, thanks for the code. JUst hacking at it slightly as I don't need to loop thru the folders, but just need to get the security at the report level.


Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top