-
Notifications
You must be signed in to change notification settings - Fork 2
Organization #407
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
base: main
Are you sure you want to change the base?
Organization #407
Conversation
There was a problem hiding this 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
privacy policy update #417
| user: UserMini; | ||
| expires_at: number; | ||
| }; | ||
| export interface ResolvedLicense { |
There was a problem hiding this comment.
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", |
There was a problem hiding this comment.
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) { |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 | |||
There was a problem hiding this comment.
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>(); |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
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); |
There was a problem hiding this comment.
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);
Migration Checklist
hyvor_user_idand add a new nullable intorganization_idcolumn to itDEPLOYMENTenv variable.AUTH_METHODHYVOR_PRIVATE_INSTANCEtohttp://hyvor.internalchange all "owners" to "admins", who have full access to the resource#462location.href) to/console