Basic connection and fetching from active directory - perl

I'm new to Perl and to Active Directory.
I need an example code of connecting into
an Active Directory server
(only address, there's no need to login),
and fetch all the details of a user by id.
I've searched the net and found script only
with the use of Net::ldap, but I am forced
to use Win32::Ole. Could someone please help
me to get it right at this way?

The best way is to use Net::Ldap. If you are not able to do so then the second best approach is to use some kind of Windows tool (like ldifde.exe/csvde.exe) and parse its output.
Basic usage: http://ss64.com/nt/csvde.html
More on ldifde: http://blogs.technet.com/b/lifeofapfe/archive/2009/02/19/using-ldifde-to-export-users-from-active-directory.aspx
Regards,

Related

Unable to install external tool 'YouSeeu' in sakai lms

I tried to install/connect Youseeu tool in sakai throught LTI. But i am not able to find any values for the following fields
1. remote URl.
2. Remote Tool Key.
3. Remote Tool Secret.
If anybody installed youseeu in sakai or any other lms, please help me out how to do that. i search lot regarding with this, but i didn't found any accurate result.
Here is the screenshot https://snag.gy/ZHGerA.jpg.
Thanks
It looks like Youseeu does use LTI (as detailed at: https://www.youseeu.com/d2l/). Typically if it will work with d2l via LTI it will work with Sakai.
However, you'll need to get the values you've highlighted from your contact at Youseeu.
The url will be where the external tool launches to (likely on youseeu's servers). The key and secret will then both encrypt and identify your connection. These values will be unique for each institution and will be generated by Youseeu.

Clone rep:policy on AEM

I am currently working on with a solution that would be able to clone/copy/backup my existing rep:policy. 'Cause when we do some jobs it accidentally removed. I am trying to apply this kind of fix, but am failing to. It says it is an invalid path.
javax.jcr.security.AccessControlException: OakAccessControl0006: Isolated policy node. Parent is not of type [rep:AccessControllable]
final Workspace ws = session.getWorkspace();
ws.copy("/etc/commerce/products/abccompany/TvPackChannelMap/rep:policy","/tmp/nxt/TvPackChannelMap/rep:policy");
Are there other ways that I can be able to take the rep:policy thru code?
You need to make sure that your job does not touch the permissions or the rep:policy, this is the best way forward for you.
The exception could be because of /etc/commerce/products/abccompany/TvPackChannelMap/rep:policy does not exist or the user whose session you are using does not have read access to the node.
Make sure the path is correct, copy paste it to your CRX/DE to make sure it exists.
I have tried to use your code to copy a rep:policy from one node to another, works fine. But I would not* recommend copying permissions that way. The best practice is to use the Access Control Management API for all things permissions.
You can check, install and use the access control tool from netcentric. It offers a jmx interface for exporting AC entries and maybe also some APIs you could use to implement your custom solution.
The Other approach is to retrieve the ACL permissions through the query language.
For example, SELECT * FROM [rep:ACL] or SELECT * FROM [rep:ACE] where [rep:principalName] is not null should give you the results.
For more information, I would recommend you to check the ACS commons ACL Packager Implementation which is available on GitHub.
Reference Link - https://github.com/Adobe-Consulting-Services/acs-aem-commons/blob/master/bundle/src/main/java/com/adobe/acs/commons/packaging/impl/ACLPackagerServletImpl.java

Problems with Forms2Go script

I am currently trying to make a form for a website in work. I have created the script in Perl using Forms2Go and have entered the send mail and bin paths given to me. At the first the script wouldn't execute but the hosts made changes to the sever and now it does.
Problem now is the script executes and takes the user to the thank you page but doesn't send the form to the e-mail address which has been tested by the hosting company.
I have a feeling that the send-mail path isn't correct and that is why it is executing but not sending the email, anything else it might be?
Thanks for reading.
Tom
Forms To Go is payware and they do not provide their source code publicly which makes trouble-shooting by the general Internet populace rather difficult. Try their support forum instead. If you're looking for a form mailer that does not suck, install nms TFMail.

How do I implement cookie based auth for a Perl website on shared hosting?

I'm very new to Perl, and I have absolutely no idea how to approach this. We have an old Perl application which previously used Apache auth; we'd like to replace this with a cookie based form-style authentication. I understand that this is very case-specific, and there is no one answer as such, but some general tips would be much appreciated.
Will I need to edit all .pl files in the website? Or is there a "golden hammer" solution I can use? Is there something on CPAN I can use? We're using Perl v5.8.8 if it matters, and we're using Apache 2 shared hosting. I am happy to provide additional information as is necessary.
For the authentication to be recognized/required, it will need to be checked by the .pl file that initially receives the user's request. So the answer to whether all .pl files will need to be changed depends on how your application is structured:
If the user goes to http://myserver.com/one.pl to do the first thing and http://myserver.com/two.pl to do the second thing, then, yes, you'll need to change them all because they're all receiving requests individually.
If the user goes to http://myserver.com/dispatch.pl?mode=one for the first thing and http://myserver.com/dispatch.pl?mode=two for the second thing and dispatch.pl calls either one.pl or two.pl behind the scenes based on the mode parameter, then you only need to change dispatch.pl, since it's the only one directly receiving requests from the user.
Edited to add: If you're dealing with the first model, then I'd strongly recommend setting up an external module (.pm file) with the cookie-handling code and calling that from each of your individual .pl files instead of duplicating that code all over the place. Ideally, this would let you get by with only a few lines of added code in each .pl:
use MyCookieHandlingModule qw(verify_cookie redirect_to_login);
my $q = CGI->new; # ...unless you're already using CGI in object-oriented mode
redirect_to_login unless verify_cookie($q);
You could do it at a level outside the Perl program.
Thanks for your answers guys, but I eventually decided on CGI::Session::Auth::DBI which works well on shared hosting.

How do I use the Groups.pm in Request Tracker?

In lib\RT\CustomFieldValues\ there is the groups.pm file which is supposed to be an example of how to get data into a custom field, but how do I actually use that once I have written it? Does anyone have any documentation or a sample of this?
I have finally figured it out, to use the Groups.pm module you need to go to /opt/rt3/etc and edit the RT_SiteConfig.pm and add the line
Set(#CustomFieldValuesSources, "RT::CustomFieldValues::Groups");
Restart Apache and it will be available as a new field source.
I have written a blog post on doing this which also includes details on how to build your own module in case anyone is interested in doing this: AD Lookup Control in Request Tracker