Skip to content
This repository has been archived by the owner on Sep 30, 2019. It is now read-only.

Commit

Permalink
Adapt facebook module to Community version 7.0.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
rizak committed Mar 31, 2015
1 parent 3326d85 commit 5b97ce4
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -226,17 +226,37 @@ private JahiaFacebookUser facebookToJahiaUser(User facebookUser, String facebook
jfu = new JahiaFacebookUser(JahiaUserManagerFacebookProvider.PROVIDER_NAME,
facebookUser.getId(), facebookUser.getId(), userProps);

// Update cache
if (jfu != null) {
// new cache to populate : cross providers only based upon names...
mProvidersUserCache.put("k" + jfu.getUserKey(), jfu);

// name storage for speed
mUserCache.put("n" + jfu.getUsername(), new JahiaUserWrapper(jfu));
mProvidersUserCache.put("n" + jfu.getUsername(), jfu);
try {

Thread currentThread = null;
ClassLoader backupClassLoader = null;
ClassLoader classLoader = this.getClass().getClassLoader();

try {
if(classLoader != null) {
currentThread = Thread.currentThread();
backupClassLoader = currentThread.getContextClassLoader();
currentThread.setContextClassLoader(classLoader);
}
// Update cache
if (jfu != null) {
// new cache to populate : cross providers only based upon names...
mProvidersUserCache.put("k" + jfu.getUserKey(), jfu);

// name storage for speed
mUserCache.put("n" + jfu.getUsername(), new JahiaUserWrapper(jfu));
mProvidersUserCache.put("n" + jfu.getUsername(), jfu);
}
// use wrappers in local cache
mUserCache.put("k" + jfu.getUserKey(), new JahiaUserWrapper(jfu));
} finally {
if(backupClassLoader != null) {
currentThread.setContextClassLoader(backupClassLoader);
}
}
} catch (Exception e) {
logger.error("Error updating user cache for JFU=" + jfu.toString(), e);
}
// use wrappers in local cache
mUserCache.put("k" + jfu.getUserKey(), new JahiaUserWrapper(jfu));

// Perform a lookup to check if we already have this user in the JCR
JCRUser jcrUser = (JCRUser) jcrUserManagerProvider.lookupExternalUser(jfu);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
<c:url var="connectUrl" value="https://graph.facebook.com/oauth/authorize">
<c:param name="client_id" value="${fbUtil:getFacebookAppID()}"/>
<c:param name="display" value="page"/>
<c:param name="redirect_uri" value="${url.server}${url.base}${renderContext.mainResource.node.path}.html"/>
<c:param name="redirect_uri" value="${url.server}${url.context}${url.base}${renderContext.mainResource.node.path}.html"/>
<c:param name="scope" value="${fbUtil:getPermissionList()}"/>
</c:url>
<a href="${connectUrl}" >
Expand Down

0 comments on commit 5b97ce4

Please sign in to comment.