FileDocCategorySizeDatePackage
UserPolicy.javaAPI DocExample1256Mon Jan 15 13:13:16 GMT 2001javasec.samples.ch15

UserPolicy

public class UserPolicy extends Policy

Fields Summary
private Policy
deferredPolicy
Constructors Summary
public UserPolicy(Policy p)

        deferredPolicy = p;
    
Methods Summary
public java.security.PermissionCollectiongetPermissions(javax.security.auth.Subject s, java.security.CodeSource cs)

        PermissionCollection pc = deferredPolicy.getPermissions(s, cs);
        if (s == null)
            return pc;      // No subject means no specific permissions
        Set principals = s.getPrincipals();
        Iterator i = principals.iterator();
        while (i.hasNext()) {
            Principal p = (Principal) i.next();
            FilePermission fp = new FilePermission(File.separator +
                                    "files" + File.separator +
                                    p.getName() + File.separator + "-",
                                                  "read,write,delete");
            pc.add(fp);
        }
        return pc;
    
public voidrefresh()

        deferredPolicy.refresh();