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

Set accessing organization as the parent of the organizations which are created #509

Merged
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ public static TypeEnum fromValue(String value) {
}

private TypeEnum type = TypeEnum.TENANT;
private String parentId = "10084a8d-113f-4211-a0d5-efe36b082211";
private String parentId;
private List<Attribute> attributes = null;


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,6 @@
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_SHARE_APPLICATION_EMPTY_REQUEST_BODY;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_INVALID_SHARE_APPLICATION_REQUEST_BODY;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.ErrorMessages.ERROR_CODE_PAGINATION_NOT_IMPLEMENTED;
import static org.wso2.carbon.identity.organization.management.service.constant.OrganizationManagementConstants.SUPER;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.buildURIForBody;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.generateUniqueID;
import static org.wso2.carbon.identity.organization.management.service.util.Utils.getOrganizationId;
Expand Down Expand Up @@ -570,8 +569,6 @@ private Organization getOrganizationFromPostRequest(OrganizationPOSTRequest orga
String parentId = organizationPOSTRequest.getParentId();
if (StringUtils.isNotBlank(parentId)) {
organization.getParent().setId(parentId);
} else {
organization.getParent().setId(SUPER);
Comment on lines -573 to -574
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The initial commit was to set the parent ID taken from the carbon context. But it is null as the organziationID is set to null when tenanted URL accesses.

Hence logic was changed to skip setting parent ID if not provided by treating it as an optional attribute. The accessing organization ID is set as the parent ID at the organization management service.

}
List<Attribute> organizationAttributes = organizationPOSTRequest.getAttributes();
if (CollectionUtils.isNotEmpty(organizationAttributes)) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -884,7 +884,6 @@ components:
type: string
example: "b4526d91-a8bf-43d2-8b14-c548cf73065b"
description: "If the parentId is not present, Super will be taken as the parent organization."
default: "10084a8d-113f-4211-a0d5-efe36b082211"
attributes:
type: array
items:
Expand Down
Loading