add: generic JWT token extraction
refactor: change project and POMs' names accordingly
This commit is contained in:
@@ -24,32 +24,4 @@
|
||||
</dependency>
|
||||
</dependencies>
|
||||
|
||||
<build>
|
||||
<finalName>ME-HuertosDeCine</finalName>
|
||||
<plugins>
|
||||
<!-- Maven Shade Plugin -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-shade-plugin</artifactId>
|
||||
<version>3.5.3</version>
|
||||
<executions>
|
||||
<execution>
|
||||
<phase>package</phase>
|
||||
<goals>
|
||||
<goal>shade</goal>
|
||||
</goals>
|
||||
<configuration>
|
||||
<createDependencyReducedPom>false</createDependencyReducedPom>
|
||||
<transformers>
|
||||
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
|
||||
<mainClass>net.miarma.api.microservices.huertosdecine.CineMainVerticle</mainClass>
|
||||
</transformer>
|
||||
</transformers>
|
||||
</configuration>
|
||||
</execution>
|
||||
</executions>
|
||||
</plugin>
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
</project>
|
||||
|
||||
@@ -29,7 +29,13 @@ public class CineAuthGuard extends AbstractAuthGuard<ViewerEntity, CineUserRole>
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean hasPermission(ViewerEntity user, CineUserRole role) {
|
||||
return user.getRole() == CineUserRole.ADMIN;
|
||||
protected boolean hasPermission(ViewerEntity member, CineUserRole userRole, CineUserRole... allowedRoles) {
|
||||
if (member == null) return false;
|
||||
if (member.getRole() == CineUserRole.ADMIN) return true;
|
||||
for (CineUserRole role : allowedRoles) {
|
||||
if (member.getRole() == role) return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user