0

I have a webpage hosted in my local server being displayed inside a Page Viewer Web Part in SharePoint 2007.

I would like to include a user check inside the pages in my server, so when an user tried to access some page through the SharePoint web part, the page would first check who is the user logged in SharePoint trying to access the page, and then check if the specific user is allowed to see that page.

I have tried the most common solutions found online using js and/or php: SPAPI, SPContext and Jquery SPServices, but wasn't able to make any of them work with the php pages in my local server.

Is there a practical way to get the user who is accessing the page? I am new to web development, so I would appreciate any help.

brWHigino
  • 260
  • 1
  • 2
  • 10

1 Answers1

1

in your case the problem is how to pass user identity from SharePoint to your PHP page as SharePoint user (as well as any other SP information) is not accessible directly in page displayed within Page Viewer webpart. Page Viewer webpart uses IFRAME to display specified page.

I suggest you to use ContentEditor webpart to include your own IFRAME and some javascript to the SharePoint page. Within the javascript you can use SPServices to get user info and pass it to SRC attribute of IFRAME as the part of PHP page URL .

Drawback of this is that advanced user can construct the the URL by itself and pass username of another user.

Jan Vanek
  • 889
  • 1
  • 6
  • 8
  • Thanks @Mazin , I'll take a good look into the things you mentioned.. I believe the first step is to find out how to place a custom iframe in my sharepoint page, right? – brWHigino Feb 07 '14 at 12:36
  • You are right. ContentEditor webpart allows you to write HTML tags (e.g. IFRAME) and javascript directly in SharePoint page. – Jan Vanek Feb 07 '14 at 20:01