Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Generic types for RBAC + Audit Logs #1192

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

julian-WorkOS
Copy link

Description

Documentation

Does this require changes to the WorkOS Docs? E.g. the API Reference or code snippets need updates.

[ ] Yes

If yes, link a related docs PR and add a docs maintainer as a reviewer. Their approval is required.

@julian-WorkOS
Copy link
Author

Example types that would be consumed:

export interface RandallTestEvent {
  action: 'randall_test_event';
  occurredAt: string;
  version?: number;
  actor: {
    id: string;
    name?: string;
  };
  targets: ({
    type: 'test_message';
    id: string;
    name?: string;
})[];
  context: {
    location: string;
    userAgent?: string;
  };
}

export interface Asd {
  action: 'asd';
  occurredAt: string;
  version?: number;
  actor: {
    id: string;
    name?: string;
    metadata: {
      key: string;
    };
  };
  targets: ({
    type: 'environment';
    id: string;
    name?: string;
})[];
  context: {
    location: string;
    userAgent?: string;
  };
}

export interface UserEnvironmentCreate {
  action: 'user.environment_create';
  occurredAt: string;
  version?: number;
  actor: {
    id: string;
    name?: string;
  };
  targets: ({
    type: 'environment';
    id: string;
    name?: string;
})[];
  context: {
    location: string;
    userAgent?: string;
  };
}

export type AuditLogEvent = RandallTestEvent | Asd | UserEnvironmentCreate

export type WorkOSRole = 'admin' | 'member' | 'auditor';
export type WorkOSPermission = 'user.read' | 'user.write' | 'organization.read';

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Development

Successfully merging this pull request may close these issues.

1 participant