The following query allows me to search all projects on which a user has the "Users" role. But it does only include 'individual' rights. If the user belongs to a group that is in the "Users" role of a project, the project is not returned. Can anyone help me to include this part as well?
Thx
SELECT DISTINCT (
P.pname
)
FROM project P
JOIN projectroleactor PRA ON P.id = PRA.pid
WHERE PRA.roletypeparameter = {currentuser}
AND PRA.projectroleid =10000
order by P.pname asc
Solved the MySQL query duration issue by indicating the first select is a subquery:
SELECT DISTINCT `PID`
FROM `projectroleactor`
WHERE `PROJECTROLEID` =10000
AND `ROLETYPE` LIKE 'atlassian-group-role-actor'
AND `ROLETYPEPARAMETER` IN
(
select * from (SELECT DISTINCT `parent_name` FROM `cwd_membership` WHERE `child_name` LIKE 'username') as subquery
)
Thanks Tiago, I digged myself into the database scheme and found a similar solution:
SELECT DISTINCT `PID` FROM `projectroleactor` WHERE `PROJECTROLEID` =10000 AND `ROLETYPE` LIKE 'atlassian-group-role-actor' AND `ROLETYPEPARAMETER` IN ( SELECT DISTINCT `parent_name` FROM `cwd_membership` WHERE `child_name` LIKE 'username' )
My problem now is that in my MySQL console, the query never returns... It hangs forever, looks like it does not like the nested 'select' statement in the 'where' clause... Just need to find out why...
=>
That's MySQL handling poorly nested select with performance issue. Would need to transform that if possible with a 'join' statement instead.
Regards
Gael
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Gael,
This query should return the same thing as your original query, but will include all members of the group JIRA-users:
SELECT DISTINCT (P.pname) FROM project P JOIN projectroleactor PRA ON P.id = PRA.pid WHERE PRA.roletypeparameter in (select child_name from cwd_membership where parent_name = 'jira-users') AND PRA.projectroleid =10000 order by P.pname asc
I hope it helps.
Cheers
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.