package com.example.onomatopoeiaback.domain.employee; import com.example.onomatopoeiaback.exceptions.ForbiddenException; import com.example.onomatopoeiaback.security.Auth; import org.springframework.security.core.Authentication; public class CheckPosition { public static void checkIsAdmin(Employee employee) { if (employee == null || !employee.getPosition().equals(PositionType.ADMINISTRATOR)) { throw new ForbiddenException(); } } public static void checkIsAdmin(Authentication authentication) { Employee employee = Auth.getEmployee(authentication); if (employee == null || !employee.getPosition().equals(PositionType.ADMINISTRATOR)) { throw new ForbiddenException(); } } }