1. Fixed the bug where policies are being set to empty during organization update (#415)
1. Fixed the bug where policies are being set to empty during organization update. 2. Added email field in organization. * Updated the test case for update organization to assert the organization policies being present post the update.
This commit is contained in:
parent
ce41fec346
commit
c253b7430b
|
|
@ -26,6 +26,8 @@ public class Organization extends BaseDomain {
|
|||
|
||||
private String website;
|
||||
|
||||
private String email;
|
||||
|
||||
private List<OrganizationSetting> organizationSettings;
|
||||
|
||||
private List<OrganizationPlugin> plugins;
|
||||
|
|
|
|||
|
|
@ -119,6 +119,9 @@ public abstract class BaseAppsmithRepositoryImpl<T extends BaseDomain> {
|
|||
Query query = new Query(Criteria.where("id").is(id));
|
||||
query.addCriteria(new Criteria().andOperator(notDeleted(), userAcl(user, permission)));
|
||||
|
||||
// Set policies to null in the update object
|
||||
resource.setPolicies(null);
|
||||
|
||||
DBObject update = getDbObject(resource);
|
||||
Update updateObj = new Update();
|
||||
Map<String, Object> updateMap = update.toMap();
|
||||
|
|
|
|||
|
|
@ -179,6 +179,14 @@ public class OrganizationServiceTest {
|
|||
@Test
|
||||
@WithUserDetails(value = "api_user")
|
||||
public void validUpdateOrganization() {
|
||||
Policy manageOrgAppPolicy = Policy.builder().permission(ORGANIZATION_MANAGE_APPLICATIONS.getValue())
|
||||
.users(Set.of("api_user"))
|
||||
.build();
|
||||
|
||||
Policy manageOrgPolicy = Policy.builder().permission(MANAGE_ORGANIZATIONS.getValue())
|
||||
.users(Set.of("api_user"))
|
||||
.build();
|
||||
|
||||
Organization organization = new Organization();
|
||||
organization.setName("Test Update Name");
|
||||
organization.setDomain("example.com");
|
||||
|
|
@ -200,6 +208,7 @@ public class OrganizationServiceTest {
|
|||
assertThat(t.getName()).isEqualTo(organization.getName());
|
||||
assertThat(t.getId()).isEqualTo(organization.getId());
|
||||
assertThat(t.getDomain()).isEqualTo("abc.com");
|
||||
assertThat(t.getPolicies()).contains(manageOrgAppPolicy, manageOrgPolicy);
|
||||
})
|
||||
.verifyComplete();
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user