diff options
author | Jesse Morgan <jesse@jesterpm.net> | 2016-03-20 17:07:26 -0700 |
---|---|---|
committer | Jesse Morgan <jesse@jesterpm.net> | 2016-03-20 17:22:38 -0700 |
commit | 55cba1e0f3373fa69d3b9a66f455ad36ab4b82cf (patch) | |
tree | bed424a7c2989b8bbd5fb874ae23b9ef674ecd8b /src/com/p4square/grow/ccb/CCBUser.java | |
parent | cac52cf3a07fb4c032f352ec48b56640b246f04f (diff) |
Adding support for Church Community Builder login.
Beginning with this change all of the Church Management System
integration logic is moving into implementations of the new
IntegrationDriver interface. The desired IntegrationDriver can be
selected by setting the integrationDriver config to the appropriate
class name.
This commit is only moving login support. Progress reporting will move
in a later commit.
Diffstat (limited to 'src/com/p4square/grow/ccb/CCBUser.java')
-rw-r--r-- | src/com/p4square/grow/ccb/CCBUser.java | 37 |
1 files changed, 37 insertions, 0 deletions
diff --git a/src/com/p4square/grow/ccb/CCBUser.java b/src/com/p4square/grow/ccb/CCBUser.java new file mode 100644 index 0000000..7313172 --- /dev/null +++ b/src/com/p4square/grow/ccb/CCBUser.java @@ -0,0 +1,37 @@ +package com.p4square.grow.ccb; + +import com.p4square.ccbapi.model.IndividualProfile; +import org.restlet.security.User; + +/** + * CCBUser is an adapter between a CCB IndividualProfile and a Restlet User. + * + * Note: CCBUser prefixes the user's identifier with "CCB-". This is done to + * ensure the identifier does not collide with identifiers from other + * systems. + */ +public class CCBUser extends User { + + private final IndividualProfile mProfile; + + /** + * Wrap an IndividualProfile inside a User object. + * + * @param profile The CCB IndividualProfile for the user. + */ + public CCBUser(final IndividualProfile profile) { + mProfile = profile; + + setIdentifier("CCB-" + mProfile.getId()); + setFirstName(mProfile.getFirstName()); + setLastName(mProfile.getLastName()); + setEmail(mProfile.getEmail()); + } + + /** + * @return The IndividualProfile of the user. + */ + public IndividualProfile getProfile() { + return mProfile; + } +} |