@Test public void shouldRequireAuthIfPrivilegeIsSpecified() { Map<ClientId, Privileges> privilege = ImmutableMap.of(AUTHENTICATED_CLIENT, createPrivilegesFor(NAMESPACE_1)); NamespaceLocker namespaceLocker = NamespaceLocker.deriveFromPrivileges(privilege); assertThat(namespaceLocker.isLocked(NAMESPACE_1)).isTrue(); assertThat(namespaceLocker.isLocked(NAMESPACE_2)).isFalse(); }
@Override public boolean isLocked(TimelockNamespace namespace) { return nonAdminPrivileges.stream().anyMatch(privilege -> privilege.hasPrivilege(namespace)); }
PrivilegeBasedNamespaceLocker implements NamespaceLocker { @Override public boolean isLocked(TimelockNamespace namespace) { return nonAdminPrivileges.stream().anyMatch(privilege -> privilege.hasPrivilege(namespace)); } }
PrivilegeBasedNamespaceLocker implements NamespaceLocker { @Override public boolean isLocked(TimelockNamespace namespace) { return nonAdminPrivileges.stream().anyMatch(privilege -> privilege.hasPrivilege(namespace)); } PrivilegeBasedNamespaceLocker(Map<ClientId, Privileges> privileges); }
PrivilegeBasedNamespaceLocker implements NamespaceLocker { @Override public boolean isLocked(TimelockNamespace namespace) { return nonAdminPrivileges.stream().anyMatch(privilege -> privilege.hasPrivilege(namespace)); } PrivilegeBasedNamespaceLocker(Map<ClientId, Privileges> privileges); @Override boolean isLocked(TimelockNamespace namespace); }
PrivilegeBasedNamespaceLocker implements NamespaceLocker { @Override public boolean isLocked(TimelockNamespace namespace) { return nonAdminPrivileges.stream().anyMatch(privilege -> privilege.hasPrivilege(namespace)); } PrivilegeBasedNamespaceLocker(Map<ClientId, Privileges> privileges); @Override boolean isLocked(TimelockNamespace namespace);  }