Fix n8n Organization Get Many failing on pending invitations
The Organization "Get Many" operation listed all viewer profiles without filtering by state, then selected each profile's nested organization field. Inactive profiles (e.g. unaccepted invitations) have no active membership, so the per-org iam:organization:get authorization check failed and the whole operation errored. Filter profiles to ACTIVE state, matching the `prb org list` CLI behavior, so only organizations the identity is an active member of are fetched. Signed-off-by: Sacha Al Himdani <sacha@probo.com>
This commit is contained in:
@@ -56,9 +56,9 @@ export async function execute(
|
||||
const limit = this.getNodeParameter('limit', itemIndex, 50) as number;
|
||||
|
||||
const query = `
|
||||
query GetOrganizations($first: Int, $after: CursorKey) {
|
||||
query GetOrganizations($first: Int, $after: CursorKey, $filter: ProfileFilter) {
|
||||
viewer {
|
||||
profiles(first: $first, after: $after) {
|
||||
profiles(first: $first, after: $after, filter: $filter) {
|
||||
edges {
|
||||
node {
|
||||
organization {
|
||||
@@ -95,7 +95,7 @@ export async function execute(
|
||||
const memberships = await proboConnectApiRequestAllItems.call(
|
||||
this,
|
||||
query,
|
||||
{},
|
||||
{ filter: { state: 'ACTIVE' } },
|
||||
(response: IDataObject) => {
|
||||
const data = response?.data as IDataObject | undefined;
|
||||
const viewer = data?.viewer as IDataObject | undefined;
|
||||
|
||||
Reference in New Issue
Block a user