Skip to content

Commit

Permalink
Removed checks for administrator and rely solely on permissions.
Browse files Browse the repository at this point in the history
  • Loading branch information
ocielliottc committed Oct 24, 2024
1 parent 9210c3b commit de8f79d
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 17 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.objectcomputing.checkins.exceptions.PermissionException;
import com.objectcomputing.checkins.services.memberprofile.MemberProfile;
import com.objectcomputing.checkins.services.memberprofile.MemberProfileServices;
import com.objectcomputing.checkins.services.memberprofile.currentuser.CurrentUserServices;
import io.micronaut.core.annotation.Nullable;
import jakarta.inject.Singleton;

Expand All @@ -18,20 +17,13 @@
public class AnniversaryReportServicesImpl implements AnniversaryServices {

private final MemberProfileServices memberProfileServices;
private final CurrentUserServices currentUserServices;

public AnniversaryReportServicesImpl(MemberProfileServices memberProfileServices,
CurrentUserServices currentUserServices) {
public AnniversaryReportServicesImpl(MemberProfileServices memberProfileServices) {
this.memberProfileServices = memberProfileServices;
this.currentUserServices = currentUserServices;
}

@Override
public List<AnniversaryReportResponseDTO> findByValue(@Nullable String[] months) {
if (!currentUserServices.isAdmin()) {
throw new PermissionException("You do not have permission to access this resource.");
}

List<MemberProfile> memberProfileAll = new ArrayList<>();
Set<MemberProfile> memberProfiles = memberProfileServices.findByValues(null, null, null, null, null, null,
false);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import com.objectcomputing.checkins.exceptions.PermissionException;
import com.objectcomputing.checkins.services.memberprofile.MemberProfile;
import com.objectcomputing.checkins.services.memberprofile.MemberProfileServices;
import com.objectcomputing.checkins.services.memberprofile.currentuser.CurrentUserServices;

import jakarta.inject.Singleton;
import java.time.LocalDate;
Expand All @@ -15,19 +14,13 @@
public class BirthDayServicesImpl implements BirthDayServices{

private final MemberProfileServices memberProfileServices;
private final CurrentUserServices currentUserServices;

public BirthDayServicesImpl(MemberProfileServices memberProfileServices, CurrentUserServices currentUserServices) {
public BirthDayServicesImpl(MemberProfileServices memberProfileServices) {
this.memberProfileServices = memberProfileServices;
this.currentUserServices = currentUserServices;
}

@Override
public List<BirthDayResponseDTO> findByValue(String[] months, Integer[] daysOfMonth) {
if (!currentUserServices.isAdmin()) {
throw new PermissionException("You do not have permission to access this resource.");
}

Set<MemberProfile> memberProfiles = memberProfileServices.findByValues(null, null, null, null, null, null, false);
List<MemberProfile> memberProfileAll = new ArrayList<>(memberProfiles);
if (months != null) {
Expand Down

0 comments on commit de8f79d

Please sign in to comment.