Skip to content

Commit

Permalink
#579 | Create Admin group on new Org creation
Browse files Browse the repository at this point in the history
  • Loading branch information
himeshr committed Jul 21, 2023
1 parent f33d018 commit 4e613b9
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
import org.springframework.data.repository.query.Param;
import org.springframework.http.HttpStatus;
import org.springframework.http.ResponseEntity;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.persistence.criteria.Predicate;
Expand Down Expand Up @@ -59,7 +58,8 @@ public ResponseEntity save(@RequestBody OrganisationContract request) {

organisationRepository.save(org);
createDefaultGenders(org);
addDefaultGroup(org.getId());
addDefaultGroup(org.getId(), Group.Everyone);
addDefaultGroup(org.getId(), Group.Administrators);
createDefaultOrgConfig(org);

return new ResponseEntity<>(org, HttpStatus.CREATED);
Expand Down Expand Up @@ -90,9 +90,9 @@ private void createGender(String genderName, Organisation org) {
genderRepository.save(gender);
}

private void addDefaultGroup(Long organisationId){
private void addDefaultGroup(Long organisationId, String groupType){
Group group = new Group();
group.setName(Group.Everyone);
group.setName(groupType);
group.setOrganisationId(organisationId);
group.setUuid(UUID.randomUUID().toString());
group.setHasAllPrivileges(true);
Expand Down

0 comments on commit 4e613b9

Please sign in to comment.