Package org.springframework.security.acls.model

Examples of org.springframework.security.acls.model.Permission


            return Arrays.asList((Permission[])permission);
        }

        if (permission instanceof String) {
            String permString = (String)permission;
            Permission p;

            try {
                p = permissionFactory.buildFromName(permString);
            } catch(IllegalArgumentException notfound) {
                p = permissionFactory.buildFromName(permString.toUpperCase());
View Full Code Here


        // This works because AbstractElement has a "getId()" method
        ObjectIdentity identity = new ObjectIdentityImpl(element);
        // ObjectIdentity identity = new ObjectIdentityImpl(element.getClass(), element.getId()); // equivalent

        // Next we need to create a Permission
        Permission permission = null;
        if (level == LEVEL_NEGATE_READ || level == LEVEL_GRANT_READ) {
            permission = BasePermission.READ;
        } else if (level == LEVEL_GRANT_WRITE) {
            permission = BasePermission.WRITE;
        } else if (level == LEVEL_GRANT_ADMIN) {
View Full Code Here

            try {
                Object fieldValue = field.get(null);

                if (Permission.class.isAssignableFrom(fieldValue.getClass())) {
                    // Found a Permission static field
                    Permission perm = (Permission) fieldValue;
                    String permissionName = field.getName();

                    registerPermission(perm, permissionName);
                }
            } catch (Exception ignore) {
View Full Code Here

        for (int i = 0; i < 32; i++) {
            int permissionToCheck = 1 << i;

            if ((mask & permissionToCheck) == permissionToCheck) {
                Permission p = registeredPermissionsByInteger.get(Integer.valueOf(permissionToCheck));

                if (p == null) {
                    throw new IllegalStateException("Mask '" + permissionToCheck + "' does not have a corresponding static Permission");
                }
                permission.set(p);
View Full Code Here

        return permission;
    }

    public Permission buildFromName(String name) {
        Permission p = registeredPermissionsByName.get(name);

        if (p == null) {
            throw new IllegalArgumentException("Unknown permission '" + name + "'");
        }
View Full Code Here

       ObjectIdentity topParentOid = new ObjectIdentityImpl(TARGET_CLASS, Long.valueOf(110));
       MutableAcl topParent = jdbcMutableAclService.createAcl(topParentOid);

       // Add an ACE permission entry
       Permission cm = new CumulativePermission().set(BasePermission.READ).set(BasePermission.ADMINISTRATION);
       assertEquals(17, cm.getMask());
       Sid benSid = new PrincipalSid(auth);
       topParent.insertAce(0, cm, benSid, true);
       assertEquals(1, topParent.getEntries().size());

       // Explicitly save the changed ACL
View Full Code Here

                } else {
                    recipient = new GrantedAuthoritySid(rs.getString("ace_sid"));
                }

                int mask = rs.getInt("mask");
                Permission permission = permissionFactory.buildFromMask(mask);
                boolean granting = rs.getBoolean("granting");
                boolean auditSuccess = rs.getBoolean("audit_success");
                boolean auditFailure = rs.getBoolean("audit_failure");

                AccessControlEntryImpl ace = new AccessControlEntryImpl(aceId, acl, recipient, permission, granting,
View Full Code Here

        if (!(arg0 instanceof Permission)) {
            return false;
        }

        Permission rhs = (Permission) arg0;

        return (this.mask == rhs.getMask());
    }
View Full Code Here

        permissionFactory = new DefaultPermissionFactory();
    }

    @Test
    public void basePermissionTest() {
        Permission p = permissionFactory.buildFromName("WRITE");
        assertNotNull(p);
    }
View Full Code Here

                new CumulativePermission().set(BasePermission.READ).set(BasePermission.ADMINISTRATION).getMask());
    }

    @Test
    public void fromInteger() {
        Permission permission = permissionFactory.buildFromMask(7);
        System.out.println("7 =  " + permission.toString());
        permission = permissionFactory.buildFromMask(4);
        System.out.println("4 =  " + permission.toString());
    }
View Full Code Here

TOP

Related Classes of org.springframework.security.acls.model.Permission

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.