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

Obtain & test user data

Status
Not open for further replies.

xlbo

MIS
Mar 26, 2002
15,080
GB
Hi,
don't even know if this ispossible so am looking for a push in the right direction if it is......

What I would like to do is obtain the userID (network) of the person calling a report. I would then need to test this userID against which Active Directory groups they are a member of. This will then set the visibility of a section dependant on.

Any ideas ??

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
gonna get this using the user!userid global in RS and put that in the WHERE clause of a dataset aligned ot the report. will then simpy iterate through the returned groups and check them against who should be able to see what

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
For anyone interested, this is the solution I have used. Rather than test the user against the groups they are in, I am testing specific groups for the existence of the user.

Code in report:
Code:
public Function GetUsersInGroup()
dim retVal
dim SecGrp as string
dim strOutPut as string
dim objGroup
dim objMember
dim CurrUser as string

CurrUser = right(environ("username"),6)

SecGrp = "Security Group Name"

objGroup = GetObject("LDAP://cn="& SecGrp &", OU=OU Name, dc=domain name, dc=co, dc=uk")

For each objMember in objGroup.Members
  strOutPut = strOutPut & objMember.sAMAccountName & ","
Next

if instr(strOutPut,CurrUser) <> 0 then
 retVal = "EIG" 'Exists In Group
else
 retVal = "DEIG" 'Doesn't Exist In Group
end if

return retVal
End Function

Section visibilities are then set to:
=iif(code.GetUsers() = "EIG",FALSE,TRUE)
which will hide the section if the user does not exist in the security group

Rgds, Geoff

We could learn a lot from crayons. Some are sharp, some are pretty and some are dull. Some have weird names and all are different colours but they all live in the same box.

Please read FAQ222-2244 before you ask a question
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top