In geometrix site if I need to get the results for page which has only user X has access
Following query pulls all the records, but I need to restrict for only X user
What are the parameters that need to be included in the url
ACL mechanism, responsible for authorization (deciding if a user has access to a resource) is quite complicated. Privileges are inherited from ancestor nodes, there are groups (and a group may be member of another group), etc. That's why it is not possible to write a query that will list nodes available for a particular user.
However, you may create a resource resolver working on behalf of any user and use it to query the repository - you'll get only resources available to the resource resolver "owner". Example:
final String user = "my-user";
final String query = "SELECT * FROM [cq:Page] AS s WHERE ISDESCENDANTNODE([/content/geometrixx/en]) ORDER BY [jcr:created]";
Map<String, Object> authInfo = new HashMap<String, Object>();
authInfo.put(ResourceResolverFactory.USER_IMPERSONATION, user);
ResourceResolver resolver = resourceResolverFactory.getAdministrativeResourceResolver(authInfo);
Iterator<Resource> result = resolver.findResources(query, "JCR-SQL2");