CREATE DEFINER=`jhise`@`localhost` PROCEDURE `project_get_by_org_user`(in i_org_id int, in i_account_key char(32))
BEGIN

	-- Get projects associatd with a user and org
    select
		p.id
	from
		project p
			join project_organization_jct poj on poj.project_id = p.id
				join permissions_project perm on perm.project_id = p.id
	where
		poj.organization_id = i_org_id and
        perm.user_account_key = i_account_key;

END
