Skip to content

Commit

Permalink
Resolve the user ID if the user is associated for the accessing organ…
Browse files Browse the repository at this point in the history
…ization
  • Loading branch information
sadilchamishka committed Oct 25, 2023
1 parent 62252b5 commit 8030fe8
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions components/org.wso2.carbon.identity.oauth/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,10 @@
<groupId>org.wso2.carbon.identity.framework</groupId>
<artifactId>org.wso2.carbon.identity.consent.server.configs.mgt</artifactId>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.organization.user.sharing</artifactId>
</dependency>

<dependency>
<groupId>org.apache.felix</groupId>
Expand Down Expand Up @@ -410,6 +414,8 @@
org.wso2.carbon.identity.organization.management.service.exception; version="${carbon.identity.organization.management.core.version.range}",
org.wso2.carbon.identity.organization.management.role.management.service; version="${carbon.identity.organization.management.version.range}",
org.wso2.carbon.identity.organization.management.role.management.service.models; version="${carbon.identity.organization.management.version.range}",
org.wso2.carbon.identity.organization.management.organization.user.sharing.util;version="${carbon.identity.organization.management.version.range}",
org.wso2.carbon.identity.organization.management.organization.user.sharing.models;version="${carbon.identity.organization.management.version.range}",

org.wso2.carbon.base; version="${carbon.base.imp.pkg.version.range}",
org.wso2.carbon.registry.api;version="${carbon.kernel.registry.imp.pkg.version.range}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@
import org.wso2.carbon.identity.oauth2.token.OAuthTokenReqMessageContext;
import org.wso2.carbon.identity.oauth2.util.OAuth2Util;
import org.wso2.carbon.identity.oauth2.util.Oauth2ScopeUtils;
import org.wso2.carbon.identity.organization.management.organization.user.sharing.util.OrganizationSharedUserUtil;
import org.wso2.carbon.identity.organization.management.service.exception.OrganizationManagementException;
import org.wso2.carbon.user.api.AuthorizationManager;
import org.wso2.carbon.user.api.UserStoreException;
Expand All @@ -62,6 +63,7 @@
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Optional;
import java.util.Set;
import java.util.regex.Pattern;
import java.util.stream.Collectors;
Expand Down Expand Up @@ -408,6 +410,11 @@ private String[] retrieveUserOrganizationPermission(AuthenticatedUser authentica
userId = authenticatedUser.getUserName();
} else {
userId = authenticatedUser.getUserId();
Optional<String> optionalUserId = OrganizationSharedUserUtil
.fetchUserIdOfAssociatedUser(userId, organizationId);
if (optionalUserId.isPresent()) {
userId = optionalUserId.get();
}
}
List<String> organizationPermissions = OAuth2ServiceComponentHolder.getRoleManager()
.getUserOrganizationPermissions(userId, organizationId);
Expand Down
7 changes: 6 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -253,6 +253,11 @@
<artifactId>org.wso2.carbon.identity.consent.server.configs.mgt</artifactId>
<version>${carbon.identity.framework.version}</version>
</dependency>
<dependency>
<groupId>org.wso2.carbon.identity.organization.management</groupId>
<artifactId>org.wso2.carbon.identity.organization.management.organization.user.sharing</artifactId>
<version>${carbon.identity.organization.management.version}</version>
</dependency>

<!--SAML Common Util dependency-->
<dependency>
Expand Down Expand Up @@ -867,7 +872,7 @@
<carbon.identity.framework.imp.pkg.version.range>[5.25.234, 7.0.0)
</carbon.identity.framework.imp.pkg.version.range>

<carbon.identity.organization.management.version>1.1.14
<carbon.identity.organization.management.version>1.3.94-SNAPSHOT
</carbon.identity.organization.management.version>
<carbon.identity.organization.management.version.range>[1.1.14, 2.0.0)
</carbon.identity.organization.management.version.range>
Expand Down

0 comments on commit 8030fe8

Please sign in to comment.