Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 1 addition & 13 deletions components/dashboard/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,13 @@ import { Login } from "./Login";
import { UserContext } from "./user-context";
import { TeamsContext } from "./teams/teams-context";
import { ThemeContext } from "./theme-context";
import { AdminContext } from "./admin-context";
import { LicenseContext } from "./license-context";
import { getGitpodService } from "./service/service";
import { shouldSeeWhatsNew, WhatsNew } from "./whatsnew/WhatsNew";
import gitpodIcon from "./icons/gitpod.svg";
import { ErrorCodes } from "@gitpod/gitpod-protocol/lib/messaging/error";
import { useHistory } from "react-router-dom";
import { trackButtonOrAnchor, trackPathChange, trackLocation } from "./Analytics";
import { ContextURL, LicenseInfo, User } from "@gitpod/gitpod-protocol";
import { ContextURL, User } from "@gitpod/gitpod-protocol";
import * as GitpodCookie from "@gitpod/gitpod-protocol/lib/util/gitpod-cookie";
import { Experiment } from "./experiments";
import { workspacesPathMain } from "./workspaces/workspaces.routes";
Expand Down Expand Up @@ -147,9 +145,7 @@ export function getURLHash() {
function App() {
const { user, setUser } = useContext(UserContext);
const { teams, setTeams } = useContext(TeamsContext);
const { setAdminSettings } = useContext(AdminContext);
const { setIsDark } = useContext(ThemeContext);
const { setLicense } = useContext(LicenseContext);

const [loading, setLoading] = useState<boolean>(true);
const [isWhatsNewShown, setWhatsNewShown] = useState(false);
Expand Down Expand Up @@ -183,14 +179,6 @@ function App() {
}
}
setTeams(teams);

if (user?.rolesOrPermissions?.includes("admin")) {
const adminSettings = await getGitpodService().server.adminGetSettings();
setAdminSettings(adminSettings);

var license: LicenseInfo = await getGitpodService().server.adminGetLicense();
setLicense(license);
Comment thread
geropl marked this conversation as resolved.
}
} catch (error) {
console.error(error);
if (error && "code" in error) {
Expand Down
6 changes: 5 additions & 1 deletion components/server/src/workspace/gitpod-server-impl.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2650,6 +2650,10 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
}

async adminGetLicense(ctx: TraceContext): Promise<LicenseInfo> {
traceAPIParams(ctx, {});
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

💯


await this.guardAdminAccess("adminGetLicense", {}, Permission.ADMIN_API);

const licenseData = this.licenseEvaluator.getLicenseData();
const licensePayload = licenseData.payload;
const licenseValid = this.licenseEvaluator.validate();
Expand All @@ -2674,7 +2678,7 @@ export class GitpodServerImpl implements GitpodServerWithTracing, Disposable {
};
}

async licenseFeatures(ctx: TraceContext, features: string[], userCount: number): Promise<string[]> {
protected async licenseFeatures(ctx: TraceContext, features: string[], userCount: number): Promise<string[]> {
var enabledFeatures: string[] = [];
for (const feature of features) {
const featureName: Feature = Feature[feature as keyof typeof Feature];
Expand Down