Skip to content

Commit

Permalink
Merge pull request #4361 from easyops-cn/steve/v2-sys
Browse files Browse the repository at this point in the history
fix(): append all auth info into SYS
  • Loading branch information
qiaofengxi authored Jul 26, 2024
2 parents 66c0726 + f0894e2 commit 46755e6
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 36 deletions.
23 changes: 6 additions & 17 deletions etc/brick-types.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@
```ts

import { History as History_2 } from 'history';
import type { History as History_2 } from 'history';
import { IconName } from '@fortawesome/fontawesome-svg-core';
import { IconPrefix } from '@fortawesome/fontawesome-svg-core';
import { Key } from 'path-to-regexp';
import { Location as Location_2 } from 'history';
import type { Key } from 'path-to-regexp';
import type { Location as Location_2 } from 'history';
import { LocationDescriptor } from 'history';
import { ThemeType } from '@ant-design/compatible/lib/icon';

Expand Down Expand Up @@ -2531,21 +2531,10 @@ export interface StoryDocTypeParameter {
type: string;
}

// Warning: (ae-incompatible-release-tags) The symbol "SystemInfo" is marked as @public, but its signature references "AuthInfo" which is marked as @internal
//
// @public
export interface SystemInfo extends RuntimeMisc {
// (undocumented)
accessRule?: string;
// (undocumented)
isAdmin?: boolean;
// (undocumented)
loginFrom?: string;
// (undocumented)
org: number;
// (undocumented)
userInstanceId: string;
// (undocumented)
username: string;
}
export type SystemInfo = AuthInfo & RuntimeMisc;

// @public (undocumented)
export type TemplateLayoutType = "wrapper";
Expand Down
8 changes: 1 addition & 7 deletions packages/brick-kit/src/core/LocationContext.ts
Original file line number Diff line number Diff line change
Expand Up @@ -194,20 +194,14 @@ export class LocationContext {
tplContextId?: string;
formContextId?: string;
}): PluginRuntimeContext {
const auth = getAuth();
const context: PluginRuntimeContext = {
hash: this.location.hash,
pathname: this.location.pathname,
query: this.query,
match,
app: this.kernel.nextApp,
sys: {
org: auth.org,
username: auth.username,
userInstanceId: auth.userInstanceId,
loginFrom: auth.loginFrom,
accessRule: auth.accessRule,
isAdmin: auth.isAdmin,
...getAuth(),
...getRuntimeMisc(),
},
flags: this.kernel.getFeatureFlags(),
Expand Down
18 changes: 6 additions & 12 deletions packages/brick-types/src/runtime.ts
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import { Key } from "path-to-regexp";
import { History, Location, LocationDescriptor } from "history";
import {
import type { Key } from "path-to-regexp";
import type { History, Location, LocationDescriptor } from "history";
import type {
BreadcrumbItemConf,
MicroApp,
BrickConf,
FeatureFlags,
SeguesConf,
BrickEventHandler,
AuthInfo,
} from "./manifest";
import { SidebarMenu, SidebarSubMenu } from "./menu";
import type { SidebarMenu, SidebarSubMenu } from "./menu";

/** @internal */
export interface CompileOptions {
Expand Down Expand Up @@ -44,14 +45,7 @@ export interface MatchParams {
/**
* 系统会话信息。
*/
export interface SystemInfo extends RuntimeMisc {
org: number;
username: string;
userInstanceId: string;
loginFrom?: string;
accessRule?: string;
isAdmin?: boolean;
}
export type SystemInfo = AuthInfo & RuntimeMisc;

/**
* 运行时杂项信息。
Expand Down

0 comments on commit 46755e6

Please sign in to comment.