Forums: Should Security.getUserGroups() work for AD groups? - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Should Security.getUserGroups() work for AD groups? Rate Topic: -----

#1 User is offline   Pete K 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 269
  • Joined: 05-February 16
  • Gender:Male

Posted 29 April 2019 - 02:42 PM

I tried to use the following code, adapted from the Security API section of the help file:



groups = Security.getUserGroups();
	if( groups["dmhs_admins"] ) 
	{
		XSession.Session["IsAdmin"] = true;
	}
	else
	{
		XSession.Session["IsAdmin"] = false;
	}


It doesn't seem to be working for me. The compiler complains:

error CS0103: The name 'groups' does not exist in the current context


I'm using AD groups.


----------------------------------------------------------
Pete K.
Lead Web Developer
Fayette County Public Schools | Lexington, Kentucky, USA
0

#2 User is offline   jadach 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 467
  • Joined: 26-April 08
  • Gender:Male
  • Location:New York

Posted 29 April 2019 - 02:52 PM

What event are you adding this to?
-jerry
0

#3 User is offline   Pete K 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 269
  • Joined: 05-February 16
  • Gender:Male

Posted 29 April 2019 - 03:03 PM

View Postjadach, on 29 April 2019 - 10:52 AM, said:

What event are you adding this to?


I'm using the After successful login event. One would think an API function would work anywhere.

I actually worked around it by using:



string groups = XSession.Session["GroupID"];
if( groups.Contains("dmhs_admins") ) 
{etc.}



But I would like to know if the Security API is fully functional with AD and if so, what I was doing wrong.



----------------------------------------------------------
Pete K.
Lead Web Developer
Fayette County Public Schools | Lexington, Kentucky, USA
0

#4 User is offline   jadach 

  • Advanced Member
  • PipPipPip
  • Group: Members
  • Posts: 467
  • Joined: 26-April 08
  • Gender:Male
  • Location:New York

Posted 29 April 2019 - 06:25 PM

Yes, that would be good to know. I am tempted to try your original approach with an app that does not use AD.
-jerry
0

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users