Skip to content

Remove automatic collaborator addition on user approval #4

Closed

Description

@neuromechanist

Current Behavior

When a user is approved, they are automatically added as a collaborator to ALL dataset repos. This causes:

  • 100+ invitation emails if there are 100 datasets
  • Access to private datasets they shouldn't see
  • Unnecessary permissions

Proposed Workflows

Workflow 1: Metadata-only changes (NO collaborator needed)

For users who want to fix TSV files, JSON metadata, documentation, etc.

User                              GitHub                         Admin
  │                                  │                              │
  │  Fork public repo                │                              │
  ├─────────────────────────────────>│                              │
  │                                  │                              │
  │  Edit metadata files locally     │                              │
  │  (TSV, JSON, README, etc.)       │                              │
  │                                  │                              │
  │  Push to fork                    │                              │
  ├─────────────────────────────────>│                              │
  │                                  │                              │
  │  Create PR from fork             │                              │
  ├─────────────────────────────────>│                              │
  │                                  ├─────────────────────────────>│
  │                                  │  Review & merge PR           │
  │                                  │<─────────────────────────────┤

No NEMAR account needed - just a GitHub account.


Workflow 2: Data changes (collaborator access required)

For users who need to upload/modify actual data files (EDF, BDF, etc.) via git-annex.

User                              NEMAR API                      Admin
  │                                  │                              │
  │  nemar dataset request-access    │                              │
  │  <dataset-id>                    │                              │
  ├─────────────────────────────────>│                              │
  │                                  │  Create access request       │
  │                                  │  Notify admin                │
  │                                  ├─────────────────────────────>│
  │                                  │                              │
  │                                  │  nemar admin grant-access    │
  │                                  │  <username> <dataset-id>     │
  │                                  │<─────────────────────────────┤
  │                                  │                              │
  │  Added as collaborator           │                              │
  │<─────────────────────────────────┤                              │
  │                                  │                              │
  │  Can now push data via git-annex │                              │

Implementation Plan

Phase 1: Remove auto-add (immediate)

  • Remove addCollaboratorToAllRepos() from approval endpoint
  • Remove removeCollaboratorFromAllRepos() from revoke endpoint

Phase 2: Per-dataset access request

  • Add dataset_access_requests table
  • Add POST /datasets/:id/request-access endpoint
  • Add nemar dataset request-access <dataset-id> CLI command
  • Add nemar admin grant-access <username> <dataset-id> CLI command
  • Add nemar admin pending-requests to list access requests

Phase 3: Notifications

  • Email admin when access requested
  • Email user when access granted/denied

Questions to Resolve

  1. Should we track which datasets a user has access to in our DB, or just rely on GitHub?
  2. Should access requests require a reason/justification?
  3. Should we support revoking access from specific datasets?

Priority

High - current behavior sends spam and grants excessive permissions

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions