Retrieving Windows environment variables from within Ebase

Post any questions you have about using the Verj.io Studio, including client and server-side programming with Javascript or FPL, and integration with databases, web services etc.

Moderators: Jon, Steve, Ian, Dave

neilnewman
Ebase User
Posts: 201
Joined: Fri Dec 20, 2013 1:29 pm
Location: Dartford Borough Council
Contact:

Retrieving Windows environment variables from within Ebase

#1

Postby neilnewman » Fri Dec 12, 2014 8:24 am

Has anyone out there got some simple to implement calls which we can use from within Ebase to find values such as the:
Users Windows AD username
User Windows AD group
Users Windows domain

The last post on the forum regarding this appeared 7 years ago, so I presume things have moved on a bit since then?

If I try the suggested call in the old post I get what appears to be the server end info and not the client credentials.
0 x

alexmcclune
Ebase User
Posts: 95
Joined: Wed Feb 27, 2013 5:16 pm

#2

Postby alexmcclune » Fri Dec 12, 2014 8:31 am

Hi,

We had this working on a test apps a while back...I think we got everything we needed from this post.

http://forum.ebasetech.com/forum/viewtopic.php?t=689

When we had setup the single-signon we then introduced permissions based upon AD Groups etc. Someone with more experience maybe able to provide more help.

This was ultimately the command to grab the attribute values:

Code: Select all

LdapServices.getUserAttribute(system.variables.$USER , 'attributename...goeshere');
0 x

Steve James
Ebase User
Posts: 331
Joined: Mon Mar 10, 2014 8:34 am

#3

Postby Steve James » Fri Dec 12, 2014 10:01 am

Hi Neil, we ended up writing a simple aspx file to output AD data in json format.

We then use a JQuery ajax call and push the data into Ebase via $eb.SetFieldValue.

eg

Code: Select all

<script>
$&#40;document&#41;.ready&#40;function&#40;&#41; &#123; 
	var TheURL = "http&#58;//&&&#123;$ENV_DOTNETWEBSERVICE_SERVER&#125;/CurrentUser/default.aspx";
	$.ajax&#40;&#123; 
		dataType&#58;"jsonp",
		contentType&#58;"text/json",
		url&#58;TheURL,
		type&#58;"get", 
		crossDomain&#58;true,
		xhrFields&#58;&#123;withCredentials&#58;true&#125;,
		success&#58; GetDets
	&#125;&#41;;

&#125;&#41;;

   function GetDets&#40;response&#41; 
	&#123;
		var UserName = '';
		UserName = response.UserAccount;
		var PCName = '';
		PCName = response.PCHost;
		var FullName = '';
		FullName = response.FullName;
		var EmailAddress = response.Email;
		SetField&#40;"USERNAME",FullName&#41;;
		SetField&#40;"USEREMAILADDRESS",EmailAddress&#41;;
	&#125;;
</script>
Sorry I can't recall why we ended up going down this line but it works well.

Thanks
0 x

neilnewman
Ebase User
Posts: 201
Joined: Fri Dec 20, 2013 1:29 pm
Location: Dartford Borough Council
Contact:

#4

Postby neilnewman » Fri Dec 12, 2014 11:53 am

Many thanks for your replies, I will give them a go and see which I can get to work first!

Thanks again
Neil
0 x


Who is online

Users browsing this forum: No registered users and 20 guests