Example usage for org.apache.shiro.authz Permission Permission

List of usage examples for org.apache.shiro.authz Permission Permission

Introduction

In this page you can find the example usage for org.apache.shiro.authz Permission Permission.

Prototype

Permission

Source Link

Usage

From source file:org.apache.access.provider.file.TestWildcardPermission.java

License:Apache License

@Test
public void testUnexpected() throws Exception {
    Permission p = new Permission() {
        @Override//from www  .  jav a2s  . co m
        public boolean implies(Permission p) {
            return false;
        }
    };
    assertFalse(ROLE_SERVER_SERVER1_DB_ALL.implies(null));
    assertFalse(ROLE_SERVER_SERVER1_DB_ALL.implies(p));
    assertFalse(ROLE_SERVER_SERVER1_DB_ALL.equals(null));
    assertFalse(ROLE_SERVER_SERVER1_DB_ALL.equals(p));

    assertEquals(ROLE_SERVER_SERVER1_DB_ALL.hashCode(),
            create(ROLE_SERVER_SERVER1_DB_ALL.toString()).hashCode());
}

From source file:org.apache.activemq.shiro.authz.ActiveMQWildcardPermissionTest.java

License:Apache License

@Test
public void testNotWildcardPermission() {
    ActiveMQWildcardPermission perm = new ActiveMQWildcardPermission("topic:TEST:*");
    Permission dummy = new Permission() {
        @Override//from w  ww . jav  a2  s .c om
        public boolean implies(Permission p) {
            return false;
        }
    };
    assertFalse(perm.implies(dummy));
}

From source file:org.apache.sentry.policy.search.TestSearchWildcardPermission.java

License:Apache License

@Test
public void testUnexpected() throws Exception {
    Permission p = new Permission() {
        @Override//from   w w w  .  j  a v  a2 s  . c o m
        public boolean implies(Permission p) {
            return false;
        }
    };
    Permission collection1 = create(new KeyValue("collection", "coll1"));
    assertFalse(collection1.implies(null));
    assertFalse(collection1.implies(p));
    assertFalse(collection1.equals(null));
    assertFalse(collection1.equals(p));
}

From source file:org.isisaddons.module.security.shiro.PrincipalForApplicationUser.java

License:Apache License

@Override
public Collection<Permission> getObjectPermissions() {
    final Permission o = new Permission() {
        @Override//from   w w w  . ja  va 2s.com
        public boolean implies(Permission p) {
            if (!(p instanceof PermissionForMember)) {
                return false;
            }
            final PermissionForMember pfm = (PermissionForMember) p;
            return getPermissionSet().grants(pfm.getFeatureId(), pfm.getMode());
        }
    };
    return Collections.singleton(o);
}