Skip to content

Conversation

@Nadil-K
Copy link
Member

@Nadil-K Nadil-K commented Feb 2, 2026

Migration Checklist

  • Find all the tables that have hyvor_user_id and add a new nullable int organization_id column to it
  • env changes
    • Add DEPLOYMENT env variable.
    • Remove AUTH_METHOD
    • Change HYVOR_PRIVATE_INSTANCE to http://hyvor.internal
  • CloudContext must be used. Org switch must be handled
  • Resource creation must be updated to use ResourceCreator HDS component
  • AuthInterface now have me() instead of check(). It returns user and organization both in an object.
  • Init calls in the Console must be updated to get the correct data needed for CloudContext
  • Resources comms
    • ResourceCreated event when created
  • adding members
    • change all "owners" to "admins", who have full access to the resource #462
    • update UI to use OrganizationMembersSearch
    • update API endpoint
      • to verify that the given user is part of the organization
      • to directly add the user to the resource
      • remove user inviting logic
  • Create the migration command (see below)
  • Send emails to first admin
  • Billing section
    • Org role-based access
      • Disable button
      • Redirect on URL access
    • Usage updates
  • Comms Events
    • MemberRemoved (remove the user from all resources of the organization)
    • UserDeleted (remove the user from all the resources)
    • LicenseChanged (optional, clear cache or something)
  • Console Authorization Updates
    • Must check that the current resource's organization = user's current organization
    • Also check that the user's current organization as seen by the frontend, is the same in the backend. In case of a mismatch, fully redirect the user (location.href) to /console
  • Design lib has to be updated 2.0.3
  • Manual testing (test with a newly signed up user, not the seeded one):
    • creating a new resource when there is no active organization
    • creating a new organization from the bar
    • switching between organizations while in the console
      • at /new
      • at /console
      • at /console/{resource}
    • cannot access resources of other organizations (redirects to /console)

Copy link
Member

@supun-io supun-io left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Rename UserLevelEndpoint to OrganizationLevelEndpoint
  • send X-Organization-Id from the frontend for those routes and the ConsoleAuthorization listener should verify the user's current organization = the organization sent from the frontend

@Nadil-K Nadil-K self-assigned this Feb 10, 2026
@Nadil-K Nadil-K requested a review from supun-io February 10, 2026 11:30
user: UserMini;
expires_at: number;
};
export interface ResolvedLicense {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

design 2.0.5 exports this. Use it

},
"dependencies": {
"@hyvor/design": "^1.1.24",
"@hyvor/design": "^2.0.3",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

upgrade to 2.0.5

$request->attributes->set(self::RESOLVED_USER_ATTRIBUTE_KEY, $user);

if ($noOrganizationRequired) {
if ($organization !== null) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

remove if and its content

if ($isUserLevelEndpoint === false) {
$user = $me->getUser();
$organization = $me->getOrganization();
$request->attributes->set(self::RESOLVED_USER_ATTRIBUTE_KEY, $user);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also set the organization attribute from here (no need to set it in two different places below). null is okay

throw new AccessDeniedHttpException('org_mismatch');
}

$request->attributes->set(self::RESOLVED_ORGANIZATION_ATTRIBUTE_KEY, $organization);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

set this above

@@ -29,7 +31,7 @@ class ConsoleInitTest extends WebTestCase
public function testInitConsole(): void
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

add a new test with no current organization for the user

export const userApprovalStatusStore = writable<ApprovalStatus>('pending');
export const authOrganizationStore = writable<CloudContextOrganization>();
export const authUserStore = writable<CloudContextUser>();
export const resolvedLicenseStore = writable<ResolvedLicense>();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can get ResolvedLicense from design system types

$pendingApprovals = $this->getEm()->getRepository(Approval::class)->findBy([
'organization_id' => null,
]);
$this->assertCount(0, $pendingApprovals);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

test should also make sure the organization_id was updated to the correct value (need the return of that rand())

$conn = $this->em->getConnection();
$userIds = $conn->fetchFirstColumn(
<<<SQL
SELECT u.hyvor_user_id
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

DISTINCT user_id
or, filter user_ids below to be unique

$userIds = array_map(function ($id) {
/** @var int|string $id */
return intval($id);
}, $userIds);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a trick:

$userIds = array_map('intval', $userIds);

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants