Code example for Permissions

Methods: implies

0
        SecurityManager sm = new SecurityManager() {
            @Override 
            public void checkPermission(Permission permission) {
                //System.out.println("P: " + permission); 
                if (mode) { //deny mode
                    if (!permissionsDenied.implies(permission)) {
                        return; 
                    } 
                } else { // grant mode 
 
                    //System.out.println("P: " + permissionsGranted); 
                    if (permissionsGranted.implies(permission)) {
                        return; 
                    } 
                } 
 
                // throw exception 
                ProtectionDomain domain = new ProtectionDomain(null,
                        new Permissions());
 
                ProtectionDomain[] context = new ProtectionDomain[] { domain };