Package org.springframework.security.acls.model

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


            return "addPermission";
        }

        PrincipalSid sid = new PrincipalSid(addPermission.getRecipient());
        Permission permission = permissionFactory.buildFromMask(addPermission.getPermission());

        try {
            contactManager.addPermission(addPermission.getContact(), sid, permission);
        } catch (DataAccessException existingPermission) {
            existingPermission.printStackTrace();
View Full Code Here


            @RequestParam("permission") int mask) {

        Contact contact = contactManager.getById(new Long(contactId));

        Sid sidObject = new PrincipalSid(sid);
        Permission permission = permissionFactory.buildFromMask(mask);

        contactManager.deletePermission(contact, sidObject, permission);

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("contact", contact);
View Full Code Here

        String[] users = {"bill", "bob", "jane"}; // don't want to mess around with consistent sample data
        Permission[] permissions = {BasePermission.ADMINISTRATION, BasePermission.READ, BasePermission.DELETE};

        for (int i = 10; i < createEntities; i++) {
            String user = users[rnd.nextInt(users.length)];
            Permission permission = permissions[rnd.nextInt(permissions.length)];
            grantPermissions(i, user, permission);

            String user2 = users[rnd.nextInt(users.length)];
            Permission permission2 = permissions[rnd.nextInt(permissions.length)];
            grantPermissions(i, user2, permission2);
        }

        SecurityContextHolder.clearContext();
    }
View Full Code Here

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

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

            try {
                p = permissionFactory.buildFromName(permString);
            } catch(IllegalArgumentException notfound) {
                p = permissionFactory.buildFromName(permString.toUpperCase());
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

            return "addPermission";
        }

        PrincipalSid sid = new PrincipalSid(addPermission.getRecipient());
        Permission permission = permissionFactory.buildFromMask(addPermission.getPermission());

        try {
            contactManager.addPermission(addPermission.getContact(), sid, permission);
        } catch (DataAccessException existingPermission) {
            existingPermission.printStackTrace();
View Full Code Here

            @RequestParam("permission") int mask) {

        Contact contact = contactManager.getById(new Long(contactId));

        Sid sidObject = new PrincipalSid(sid);
        Permission permission = permissionFactory.buildFromMask(mask);

        contactManager.deletePermission(contact, sidObject, permission);

        Map<String, Object> model = new HashMap<String, Object>();
        model.put("contact", contact);
View Full Code Here

            try {
                Object fieldValue = fields[i].get(null);

                if (Permission.class.isAssignableFrom(fieldValue.getClass())) {
                    // Found a Permission static field
                    Permission perm = (Permission) fieldValue;
                    String permissionName = fields[i].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

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.