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

SAK-50915 LTI send instructor role for DA user with instructor perms #13238

Merged
merged 2 commits into from
Jan 27, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 19 additions & 20 deletions lti/lti-common/src/java/org/sakaiproject/lti/util/SakaiLTIUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -609,30 +609,29 @@ public static void addUserInfo(Properties ltiProps, Properties lti13subst, User
}
}

public static String getCurrentUserSakaiRole(User user, String context, String roleMapProp) {
public static String getCurrentUserSakaiRole(User user, String context) {
if (user == null) return null;

String realmId = SiteService.siteReference(context);
Map<String, String> toolRoleMap = convertOutboundRoleMapPropToMap(roleMapProp);
Map<String, String> propRoleMap = convertOutboundRoleMapPropToMap(
ServerConfigurationService.getString(LTI_OUTBOUND_ROLE_MAP)
);
Map<String, String> defaultRoleMap = convertOutboundRoleMapPropToMap(LTI_OUTBOUND_ROLE_MAP_DEFAULT);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

you dont use these. this method seems to be about returning a Sakai role only.


try {
if (user != null) {
Role role = null;
String sakaiRole = null;
AuthzGroup realm = ComponentManager.get(AuthzGroupService.class).getAuthzGroup(realmId);
if (realm != null) {
role = realm.getUserRole(user.getId());
Role role = null;
String sakaiRole = null;
AuthzGroup realm = ComponentManager.get(AuthzGroupService.class).getAuthzGroup(realmId);
if (realm != null) {
role = realm.getUserRole(user.getId());

Copy link
Contributor

Choose a reason for hiding this comment

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

Now I see what you are doing. White space though :)

// Handle a delegated access user
if (role == null && SiteService.allowUpdateSite(context)) {
role = realm.getRole(realm.getMaintainRole());
}
if (role != null) {
sakaiRole = role.getId();
}
if (StringUtils.isNotBlank(sakaiRole)) return sakaiRole;
}
} catch (GroupNotDefinedException e) {
log.error("SiteParticipantHelper.getExternalRealmId: site realm not found {}", e.getMessage());
}
if (role != null) {
sakaiRole = role.getId();
}
if (StringUtils.isNotBlank(sakaiRole)) return sakaiRole;
} catch (GroupNotDefinedException e) {
log.error("site realm not found {}", e.getMessage());
}
return null;
}
Expand All @@ -650,7 +649,7 @@ public static String getFallBackRole(String context) {

public static void addRoleInfo(Properties props, Properties lti13subst, User user, String context, String roleMapProp) {

String sakaiRole = SecurityService.isSuperUser() ? "admin" : getCurrentUserSakaiRole(user, context, roleMapProp);
String sakaiRole = SecurityService.isSuperUser() ? "admin" : getCurrentUserSakaiRole(user, context);

String outboundRole = null;
if (StringUtils.isNotBlank(sakaiRole)) {
Expand Down
Loading