Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Get the agent string from the Fedora user principal attribute in the JCR session. #17

Merged
merged 1 commit into from Sep 3, 2015
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Expand Up @@ -100,8 +100,11 @@ public String toString() {
public boolean rolesHavePermission(final Session userSession, final String absPath,
final String[] actions, final Set<String> roles) {

// This is not correct -- we should get it from the container or header, etc
final String agent = userSession.getUserID();
// use the user principal as the WebAC agent
// if there is no logged-in user, the user principal will be the EVERYONE principal, so
// the agent will be FOAF_AGENT_VALUE (i.e., the URI string for foaf:Agent)
final Principal userPrincipal = (Principal) userSession.getAttribute(FEDORA_USER_PRINCIPAL);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't believe FEDORA_USER_PRINCIPAL is defined anywhere.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

final String agent = userPrincipal.getName();

try {
final Map<String, List<String>> resourceAccessRoles =
Expand Down