/** * Construct a chain of resource parents starting with the resource and ending with the root. * * @param resource The staring point. * @return list of resource in the chain form start to the root. */ public static List<? extends IResource> chain(IResource resource) { List<IResource> chain = new ArrayList<IResource>(); while (true) { chain.add(resource); if (!resource.hasParent()) break; resource = resource.getParent(); } return chain; }
/** * Construct a chain of resource parents starting with the resource and ending with the root. * * @param resource The staring point. * @return list of resource in the chain form start to the root. */ public static List<? extends IResource> chain(IResource resource) { List<IResource> chain = new ArrayList<IResource>(); while (true) { chain.add(resource); if (!resource.hasParent()) break; resource = resource.getParent(); } return chain; }
/** * Construct a chain of resource parents starting with the resource and ending with the root. * * @param resource The staring point. * @return list of resource in the chain form start to the root. */ public static List<? extends IResource> chain(IResource resource) { List<IResource> chain = new ArrayList<IResource>(); while (true) { chain.add(resource); if (!resource.hasParent()) break; resource = resource.getParent(); } return chain; }
/** * Construct a chain of resource parents starting with the resource and ending with the root. * * @param resource The staring point. * @return list of resource in the chain form start to the root. */ public static List<? extends IResource> chain(IResource resource) { List<IResource> chain = new ArrayList<IResource>(); while (true) { chain.add(resource); if (!resource.hasParent()) break; resource = resource.getParent(); } return chain; }
public void ensureHasPermission(Permission perm, IResource resource) throws UnauthorizedException { if (!DatabaseDescriptor.getAuthorizer().requireAuthorization()) return; // Access to built in functions is unrestricted if(resource instanceof FunctionResource && resource.hasParent()) if (((FunctionResource)resource).getKeyspace().equals(SchemaConstants.SYSTEM_KEYSPACE_NAME)) return; checkPermissionOnResourceChain(perm, resource); }
public void ensureHasPermission(Permission perm, IResource resource) throws UnauthorizedException { if (!DatabaseDescriptor.getAuthorizer().requireAuthorization()) return; // Access to built in functions is unrestricted if(resource instanceof FunctionResource && resource.hasParent()) if (((FunctionResource)resource).getKeyspace().equals(SchemaConstants.SYSTEM_KEYSPACE_NAME)) return; checkPermissionOnResourceChain(perm, resource); }
public void ensureHasPermission(Permission perm, IResource resource) throws UnauthorizedException { if (!DatabaseDescriptor.getAuthorizer().requireAuthorization()) return; // Access to built in functions is unrestricted if(resource instanceof FunctionResource && resource.hasParent()) if (((FunctionResource)resource).getKeyspace().equals(SchemaConstants.SYSTEM_KEYSPACE_NAME)) return; checkPermissionOnResourceChain(perm, resource); }