Skip to main content

Deactivate Workspace

Motivation

Principles

  • Workspace with WorkspaceDescriptor.Status != Active accepts only System token. 403 forbidden otherwise
  • Workspace is (consistently) inactive if:
    • Workspace/WorkspaceDescriptor.Status == Inactive
    • There is no any active JoinedWorkspace record which refers to the Workspace
    • Note that Workspace.Subject records are still active
    • AppWorkspace/WorkspaceID[Workspace].IsActive == false
  • The following case is possible: cdoc.sys.WorkspaceID.IsActive == true but it is impossible to work there because cdoc.sys.WorkspaceDescriptor.Status != Active already. Consistency is gauranteed within a single partition only, here there are 2 different partitions
  • Deactivating a previously created workspaces is possible but nothing will be made on c.sys.OnJoinedWorkspaceDeactivated beacuse:
    • there was no sp.sys.WorkspaceIDIdx
    • there was no field view.sys.WorkspaceIDIdx.InvitingWorkspaceWSID
  • c.sys.OnWorkspaceDeactivated is routed to the app and pseudoWSID where cdoc.sys.WorkspaceID actually lives:
    • child workspace (ownerApp == projectorApp): ownerApp at pseudoWSID(ownerWSID, wsName)
    • login profile (ownerApp != projectorApp): projectorApp (= target app) at pseudoWSID(NullWSID, wsName) — per pkg/registry/impl_invokecreateworkspaceid.go
  • c.sys.OnWorkspaceDeactivated and c.sys.OnChildWorkspaceDeactivated are issued with a system token for ownerApp (separate from the projector-app token) when ownerApp != projectorApp, e.g., login-profile deactivation cascade where the registry login lives in sys/registry

c.sys.InitiateDeactivateWorkspace()

  • AuthZ: role.sys.WorkspaceOwner
  • Params: none
  • cdoc.sys.WorkspaceID existence in appWS is checked by view.sys.WorkspaceIDIdx but there was no this view before. So need to check the existence of the link to cdoc.sys.WorkspaceID before checking cdoc.sys.WorkspaceID.IsActive