geode-core/src/test/java/org/apache/geode/management/internal/security/DataCommandsSecurityTest.java
@ConnectionConfiguration(user = "region1-user", password = "1234567")
  @Test
  public void testRegionAccess() {
    assertThatThrownBy(() -> bean.processCommand("rebalance --include-region=region2"))
        .isInstanceOf(GemFireSecurityException.class)
        .hasMessageContaining(ResourcePermissions.DATA_MANAGE.toString());

    assertThatThrownBy(
        () -> bean.processCommand("export data --region=region2 --file=foo.txt --member=value"))
            .isInstanceOf(GemFireSecurityException.class);
    assertThatThrownBy(
        () -> bean.processCommand("import data --region=region2 --file=foo.txt --member=value"))
            .isInstanceOf(GemFireSecurityException.class);

    assertThatThrownBy(() -> bean.processCommand("put --key=key1 --value=value1 --region=region2"))
        .isInstanceOf(GemFireSecurityException.class).hasMessageContaining("DATA:WRITE:region2");

    assertThatThrownBy(() -> bean.processCommand("get --key=key1 --region=region2"))
        .isInstanceOf(GemFireSecurityException.class).hasMessageContaining("DATA:READ:region2");
  }
// dataUser has all the permissions granted, but not to region2 (only to region1)
dataUser has all the permissions granted, but not to region2 (only to region1)
dataUser has all the permissions granted but not to region2 ( only to region1 )
@ConnectionConfiguration(user = "region1-user", password = "1234567")
  @Test
  public void testRegionAccess() {
    assertThatThrownBy(() -> bean.processCommand("rebalance --include-region=region2"))
        .isInstanceOf(GemFireSecurityException.class)
        .hasMessageContaining(ResourcePermissions.DATA_MANAGE.toString());
    assertThatThrownBy(
        () -> bean.processCommand("export data --region=region2 --file=foo.txt --member=value"))
            .isInstanceOf(GemFireSecurityException.class);
    assertThatThrownBy(
        () -> bean.processCommand("import data --region=region2 --file=foo.txt --member=value"))
            .isInstanceOf(GemFireSecurityException.class);
    assertThatThrownBy(() -> bean.processCommand("put --key=key1 --value=value1 --region=region2"))
        .isInstanceOf(GemFireSecurityException.class).hasMessageContaining("DATA:WRITE:region2");
    assertThatThrownBy(() -> bean.processCommand("get --key=key1 --region=region2"))
        .isInstanceOf(GemFireSecurityException.class).hasMessageContaining("DATA:READ:region2");
  }
@ ConnectionConfiguration ( user = "region1-user" , password = "1234567" ) @ Test public void testRegionAccess ( ) { assertThatThrownBy ( ( ) -> bean . processCommand ( "rebalance --include-region=region2" ) ) . isInstanceOf ( GemFireSecurityException . class ) . hasMessageContaining ( ResourcePermissions . DATA_MANAGE . toString ( ) ) ; assertThatThrownBy ( ( ) -> bean . processCommand ( "export data --region=region2 --file=foo.txt --member=value" ) ) . isInstanceOf ( GemFireSecurityException . class ) ; assertThatThrownBy ( ( ) -> bean . processCommand ( "import data --region=region2 --file=foo.txt --member=value" ) ) . isInstanceOf ( GemFireSecurityException . class ) ; assertThatThrownBy ( ( ) -> bean . processCommand ( "put --key=key1 --value=value1 --region=region2" ) ) . isInstanceOf ( GemFireSecurityException . class ) . hasMessageContaining ( "DATA:WRITE:region2" ) ; assertThatThrownBy ( ( ) -> bean . processCommand ( "get --key=key1 --region=region2" ) ) . isInstanceOf ( GemFireSecurityException . class ) . hasMessageContaining ( "DATA:READ:region2" ) ; }
dataUser has all the permissions granted, but not to region2 (only to region1)
dataUser has all the permissions granted but not to region2 ( only to region1 )