Skip to content
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

fix(): append all auth info into SYS #4361

Merged
merged 1 commit into from
Jul 26, 2024
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
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
Loading