Determining If One Permission Implies Another : Permission « Security « Java






Determining If One Permission Implies Another

   

import java.io.FilePermission;
import java.security.Permission;

public class Main {
  public static void main(String[] argv) throws Exception {
    Permission perm1 = new FilePermission("/tmp/*", "read,write");
    Permission perm2 = new FilePermission("/tmp/abc", "read");

    if (perm1.implies(perm2)) {
      System.out.println("perm1 implies perm2"); 
    }

  }
}

   
    
    
  








Related examples in the same category

1.Checking Read/Write Permission for a Directory
2.Creating a Custom Permission
3.extends BasicPermission
4.boolean Permission.implies(Permission permission)
5.Controlling Access to an Object using a permission
6.Guard guard = new PropertyPermission("java.home", "read");
7.Listing All Permissions Granted to a Loaded Class
8.new GuardedObject(Object obj, Guard)
9.Object GuardedObject.getObject()
10.Execution of reflection