Have figured this out now... and it has nothing to do with the code I posted. I 
was setting the active project on a SessionControl belonging to the root user 
rather than the impersonated one - so the filter wasn't being applied.

Mark.

________________________________________
From: [email protected] 
[[email protected]] On Behalf Of Woodbridge, Mark R 
[[email protected]]
Sent: 22 July 2010 13:17
To: [email protected]
Subject: [base] API Question

Hi,

I'm trying to display a list of the projects and experiments that a user has 
access to. I'm using the following code:

ItemQuery<Project> projects = Project.getQuery();
projects.include(Include.ALL);
for (Project project : projects.list(dc)) {
        if (!project.isRemoved()) {
                sc.setActiveProject(project);
                ItemQuery<Experiment> experiments = Experiment.getQuery();
                
experiments.setIncludes(Collections.singleton(Include.IN_PROJECT));
                System.out.println(experiments.count(dc);
        }
}

This works for the owner of the data but not for other members of the project 
(who have shared access).

If I log into the web interface I can set the active project manually and view 
the associated experiments, even if I am not the owner.

Is there something wrong with my code? I've tried INCLUDE_ALL instead of 
IN_PROJECT but this didn't help...

Mark.
------------------------------------------------------------------------------
This SF.net email is sponsored by Sprint
What will you do first with EVO, the first 4G phone?
Visit sprint.com/first -- http://p.sf.net/sfu/sprint-com-first
_______________________________________________
The BASE general discussion mailing list
[email protected]
unsubscribe: send a mail with subject "unsubscribe" to
[email protected]

------------------------------------------------------------------------------
The Palm PDK Hot Apps Program offers developers who use the
Plug-In Development Kit to bring their C/C++ apps to Palm for a share
of $1 Million in cash or HP Products. Visit us here for more details:
http://p.sf.net/sfu/dev2dev-palm
_______________________________________________
The BASE general discussion mailing list
[email protected]
unsubscribe: send a mail with subject "unsubscribe" to
[email protected]

Reply via email to