diff --git a/lib/Conch/DB/ResultSet/Build.pm b/lib/Conch/DB/ResultSet/Build.pm index 6af47c070..4c68b1d27 100644 --- a/lib/Conch/DB/ResultSet/Build.pm +++ b/lib/Conch/DB/ResultSet/Build.pm @@ -94,14 +94,16 @@ sub user_has_role ($self, $user_id, $role) { my $via_user_rs = $self ->search_related('user_build_roles', { user_id => $user_id }) ->with_role($role) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); my $via_org_rs = $self ->related_resultset('organization_build_roles') ->with_role($role) ->related_resultset('organization') ->search_related('user_organization_roles', { user_id => $user_id }) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); return $via_user_rs->union_all($via_org_rs)->exists; } diff --git a/lib/Conch/DB/ResultSet/Device.pm b/lib/Conch/DB/ResultSet/Device.pm index f99a1e317..a5bf1151c 100644 --- a/lib/Conch/DB/ResultSet/Device.pm +++ b/lib/Conch/DB/ResultSet/Device.pm @@ -92,7 +92,8 @@ sub user_has_role ($self, $user_id, $role) { ->related_resultset('build') ->search_related('user_build_roles', { user_id => $user_id }) ->with_role($role) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); my $via_org_rs = $self ->related_resultset('build') @@ -100,7 +101,8 @@ sub user_has_role ($self, $user_id, $role) { ->with_role($role) ->related_resultset('organization') ->search_related('user_organization_roles', { user_id => $user_id }) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); return 1 if $via_user_rs->union_all($via_org_rs)->exists; diff --git a/lib/Conch/DB/ResultSet/Rack.pm b/lib/Conch/DB/ResultSet/Rack.pm index 4708e0aaa..25ac4feb4 100644 --- a/lib/Conch/DB/ResultSet/Rack.pm +++ b/lib/Conch/DB/ResultSet/Rack.pm @@ -103,7 +103,8 @@ sub user_has_role ($self, $user_id, $role) { ->related_resultset('workspace') ->search_related('user_workspace_roles', { user_id => $user_id }) ->with_role($role) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); my $build_rs = $self->related_resultset('build'); @@ -111,14 +112,16 @@ sub user_has_role ($self, $user_id, $role) { my $build_via_user_rs = $build_rs ->search_related('user_build_roles', { user_id => $user_id }) ->with_role($role) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); my $build_via_org_rs = $build_rs ->related_resultset('organization_build_roles') ->with_role($role) ->related_resultset('organization') ->search_related('user_organization_roles', { user_id => $user_id }) - ->related_resultset('user_account'); + ->related_resultset('user_account') + ->columns(['id']); return $ws_via_user_rs ->union_all($build_via_user_rs)