Role { public static ApplicationRole buildService(TenantName tenant, ApplicationName application) { return new ApplicationRole(RoleDefinition.buildService, tenant, application); } Role(RoleDefinition roleDefinition, Context context); static UnboundRole hostedOperator(); static UnboundRole hostedSupporter(); static UnboundRole everyone(); static TenantRole athenzTenantAdmin(TenantName tenant); static TenantRole reader(TenantName tenant); static TenantRole developer(TenantName tenant); static TenantRole administrator(TenantName tenant); static ApplicationRole headless(TenantName tenant, ApplicationName application); static ApplicationRole buildService(TenantName tenant, ApplicationName application); static UnboundRole systemFlagsDeployer(); static UnboundRole systemFlagsDryrunner(); static UnboundRole paymentProcessor(); static UnboundRole hostedAccountant(); RoleDefinition definition(); boolean implies(Role other); @Override boolean equals(Object o); @Override int hashCode();  }
@Test public void build_service_membership() { Role role = Role.buildService(TenantName.from("t1"), ApplicationName.from("a1")); assertFalse(publicEnforcer.allows(role, Action.create, URI.create("/not/explicitly/defined"))); assertFalse(publicEnforcer.allows(role, Action.update, URI.create("/application/v4/tenant/t1/application/a1"))); assertTrue(publicEnforcer.allows(role, Action.create, URI.create("/application/v4/tenant/t1/application/a1/submit"))); assertFalse("No global read access", publicEnforcer.allows(role, Action.read, URI.create("/controller/v1/foo"))); }