
profile.pl -- User profile configuration
Complementary to authentication, this module configures the maintenance
of user profiles.
There are several places where we need interaction with the user
profile:
- Prolog gathering and maintenance
- If a new user is found we want to welcome the user and
optionally complete the profile. For example, we may wish
to ask the
email
for the new user and start a process to
verify this.
- A user must be able to edit and delete his/her profile.
- A user must be able to migrate a profile, probably only from
a profile with the same verified email address.
- Profile usage
- Claim ownership
- Grant access. Access points in SWISH should be
- Execution of goals
- Normal sandboxed/not-sandboxed operations
- Grant/Deny access to certain sensitive (database)
predicates.
- Viewing/using code
- Saving code
- Save in general (e.g., do not save when anonymous)
- Make revisions to files that are not yours
- Save non-versioned files
- Add modules to the version store?
- Send notifications
- By mail
- Maintain notification queue for a user
swish_config:reply_logged_in(+Options)[multifile]- Hook logins from federated identity provides. Options processed:
- user_info(+UserInfo:Dict)
- Provides information about the user provided by the external
identity provider.
- reply(+Format)
- If Format =
html
, reply with an HTML page. Other values
are left for future extensions.
- profile_id(-Id)
- Unify Id with the found or created profile id.
known_profile(+Info, -ProfileID) is semidet[private]- True when ProfileID is the profile identifier for the authenticated
user.
associate_profile(+ProfileID) is det[private]- Associate the current session with the given ProfileID. Broadcasts
SWISH event
profile(ProfileID)
.
init_session_profile[private]- This deals with the case where a session is opened, but login is
continued because it is based on HTTP authentication. If the server
opens a session, we check for the current identity and associate the
related profile.
swish_config:reply_logged_out(+Options)[multifile]- Perform a logout, removing the link to the session
create_profile(+UserInfo, +IDProvider, -ProfileID)[private]- Create a new user profile.
last_login(+User)//[private]- Indicate when the user used this server for the last time.
swish_config:user_profile(+Request, -Profile) is semidet[multifile]- Provide the profile for the current user. The Profile dict contains
the profile keys and the
profile_id
key.
user_profile(+Request)[private]- Emit an HTML page that allows for viewing, updating and deleting a
user profile.
save_profile(+Request)[private]- Update the profile for the current user. The form sends a JSON
object that contains a value for all non-disabled fields that have a
non-null value.
save_profile(+User, +Dict) is det[private]- Update the profile for User with values from Dict.
update_profile(+Request)[private]- Update a profile with new information from the identity provider
delete_profile(+Request)[private]- Completely delete the profile for the current user
profile_name(+ProfileID, -Name) is semidet[private]- Name is the public name associated with Profile.
swish_search:typeahead(+Set, +Query, -Match, +Options) is nondet[multifile]- Find users based on their profile. This handler defines the set
user
. A Match is a dict holding:
- id:ProfileID
- label:Name
- A reasonable name for the user
- email:Email
- Only present if the match was found on the email.
- hit:hit{key:Key, value:Value}
- Field key and value on which the hit was found
- avatar:Avatar
- Avatar URL