Skip to content

Commit

Permalink
add ecosystem id + getters in permission port
Browse files Browse the repository at this point in the history
  • Loading branch information
AnthonyBuisset committed Sep 23, 2024
1 parent 2c4fd98 commit 1548a62
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
package onlydust.com.marketplace.kernel.model;

import com.fasterxml.jackson.annotation.JsonCreator;
import lombok.EqualsAndHashCode;
import lombok.NoArgsConstructor;
import lombok.NonNull;
import lombok.experimental.SuperBuilder;

import java.util.UUID;

@NoArgsConstructor(staticName = "random")
@EqualsAndHashCode(callSuper = true)
@SuperBuilder
public class EcosystemId extends UuidWrapper {
public static EcosystemId of(@NonNull final UUID uuid) {
return EcosystemId.builder().uuid(uuid).build();
}

@JsonCreator
public static EcosystemId of(@NonNull final String uuid) {
return EcosystemId.of(UUID.fromString(uuid));
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import onlydust.com.marketplace.kernel.model.SponsorId;
import onlydust.com.marketplace.kernel.model.UserId;

import java.util.List;
import java.util.Optional;

public interface PermissionPort {
Expand All @@ -24,6 +25,14 @@ public interface PermissionPort {

boolean isUserProgramLead(UserId userId, ProgramId programId);

List<ProgramId> getLeadPrograms(UserId userId);

List<EcosystemId> getLeadEcosystems(UserId userId);

List<SponsorId> getLeadSponsors(UserId userId);

List<ProjectId> getLeadProjects(UserId userId);

default boolean hasUserAccessToProgram(UserId userId, ProgramId programId) {
return isUserProgramLead(userId, programId) || isUserSponsorLeadOfProgram(userId, programId);
}
Expand Down

0 comments on commit 1548a62

Please sign in to comment.