-
Notifications
You must be signed in to change notification settings - Fork 11k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
062e6a8
commit 16cf6df
Showing
1 changed file
with
20 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,31 +1,33 @@ | ||
import { Meteor } from 'meteor/meteor'; | ||
import { Tracker } from 'meteor/tracker'; | ||
|
||
import { hasPermission, hasRole } from '../../app/authorization/client'; | ||
import { hasRole } from '../../app/authorization/client'; | ||
import { settings } from '../../app/settings/client'; | ||
import { sdk } from '../../app/utils/client/lib/SDKClient'; | ||
// import { sdk } from '../../app/utils/client/lib/SDKClient'; | ||
import { router } from '../providers/RouterProvider'; | ||
|
||
Meteor.startup(async () => { | ||
const { registrationStatus } = await sdk.rest.get('/v1/cloud.registrationStatus'); | ||
Meteor.startup( | ||
/* async*/ () => { | ||
// const { registrationStatus } = await sdk.rest.get('/v1/cloud.registrationStatus'); | ||
|
||
Tracker.autorun(() => { | ||
const setupWizardState = settings.get('Show_Setup_Wizard'); | ||
Tracker.autorun(() => { | ||
const setupWizardState = settings.get('Show_Setup_Wizard'); | ||
|
||
const hasRegisterCloudPermission = hasPermission('register-on-cloud'); | ||
const userId = Meteor.userId(); | ||
// const hasRegisterCloudPermission = hasPermission('register-on-cloud'); | ||
const userId = Meteor.userId(); | ||
|
||
const isAdmin = userId && hasRole(userId, 'admin'); | ||
const isAdmin = userId && hasRole(userId, 'admin'); | ||
|
||
const isWizardInProgress = isAdmin && setupWizardState === 'in_progress'; | ||
const isWizardInProgress = isAdmin && setupWizardState === 'in_progress'; | ||
|
||
const isWorkspaceRegistered = registrationStatus?.workspaceRegistered; | ||
// const isWorkspaceRegistered = registrationStatus?.workspaceRegistered; | ||
|
||
const mustRedirect = | ||
(!userId && setupWizardState === 'pending') || isWizardInProgress || (!isWorkspaceRegistered && hasRegisterCloudPermission); | ||
const mustRedirect = | ||
(!userId && setupWizardState === 'pending') || isWizardInProgress; /* || (!isWorkspaceRegistered && hasRegisterCloudPermission)*/ | ||
|
||
if (mustRedirect) { | ||
router.navigate('/setup-wizard'); | ||
} | ||
}); | ||
}); | ||
if (mustRedirect) { | ||
router.navigate('/setup-wizard'); | ||
} | ||
}); | ||
}, | ||
); |