发布 0.1.0:通知渠道、告警规则与多项体验修复
This commit is contained in:
+25
-14
@@ -5,6 +5,7 @@ import type {
|
||||
LoginRequest,
|
||||
LoginResponse,
|
||||
OAuthSettings,
|
||||
SessionRefresh,
|
||||
TotpSetup,
|
||||
TotpStatus,
|
||||
UpdateCredentialsRequest,
|
||||
@@ -26,6 +27,14 @@ export function logout(): Promise<void> {
|
||||
return request('/auth/logout', { method: 'POST' })
|
||||
}
|
||||
|
||||
// ---- 会话 ----
|
||||
|
||||
/** 撤销全部会话:旧 token 全部失效,响应带操作者的新会话 */
|
||||
export function revokeSessions(): Promise<SessionRefresh> {
|
||||
if (mockOn) return mocked({ token: 'mock-token-2', expiresAt: '2099-01-01T00:00:00Z' }, 300)
|
||||
return request('/auth/revoke-sessions', { method: 'POST' })
|
||||
}
|
||||
|
||||
// ---- 登录凭据 ----
|
||||
|
||||
export function getCredentials(): Promise<CredentialsInfo> {
|
||||
@@ -33,15 +42,15 @@ export function getCredentials(): Promise<CredentialsInfo> {
|
||||
return request('/auth/credentials')
|
||||
}
|
||||
|
||||
/** 修改用户名 / 密码;成功后旧 token 随即失效,调用方应登出重登 */
|
||||
export function updateCredentials(body: UpdateCredentialsRequest): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 400)
|
||||
/** 修改用户名 / 密码;成功后旧 token 全部失效,响应带操作者的新会话 */
|
||||
export function updateCredentials(body: UpdateCredentialsRequest): Promise<SessionRefresh> {
|
||||
if (mockOn) return mocked({ token: 'mock-token-2', expiresAt: '2099-01-01T00:00:00Z' }, 400)
|
||||
return request('/auth/credentials', { method: 'PUT', body })
|
||||
}
|
||||
|
||||
/** 保存密码登录禁用开关;开启要求至少绑定一个外部身份(后端 409) */
|
||||
export function updatePasswordLogin(disabled: boolean): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 300)
|
||||
/** 保存密码登录禁用开关;成功后旧 token 全部失效,响应带新会话 */
|
||||
export function updatePasswordLogin(disabled: boolean): Promise<SessionRefresh> {
|
||||
if (mockOn) return mocked({ token: 'mock-token-2', expiresAt: '2099-01-01T00:00:00Z' }, 300)
|
||||
return request('/auth/password-login', { method: 'PUT', body: { disabled } })
|
||||
}
|
||||
|
||||
@@ -62,14 +71,15 @@ export function setupTotp(): Promise<TotpSetup> {
|
||||
return request('/auth/totp/setup', { method: 'POST' })
|
||||
}
|
||||
|
||||
export function activateTotp(code: string): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 300)
|
||||
/** 激活两步验证;成功后旧 token 全部失效,响应带新会话 */
|
||||
export function activateTotp(code: string): Promise<SessionRefresh> {
|
||||
if (mockOn) return mocked({ token: 'mock-token-2', expiresAt: '2099-01-01T00:00:00Z' }, 300)
|
||||
return request('/auth/totp/activate', { method: 'POST', body: { code } })
|
||||
}
|
||||
|
||||
/** 停用两步验证;密码或当前验证码任一确认 */
|
||||
export function disableTotp(body: { password?: string; code?: string }): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 300)
|
||||
/** 停用两步验证;密码或当前验证码任一确认,响应带新会话 */
|
||||
export function disableTotp(body: { password?: string; code?: string }): Promise<SessionRefresh> {
|
||||
if (mockOn) return mocked({ token: 'mock-token-2', expiresAt: '2099-01-01T00:00:00Z' }, 300)
|
||||
return request('/auth/totp/disable', { method: 'POST', body })
|
||||
}
|
||||
|
||||
@@ -92,7 +102,7 @@ export function getOauthProviders(): Promise<{
|
||||
return request('/auth/oauth/providers')
|
||||
}
|
||||
|
||||
/** 获取授权跳转 URL;bind 模式要求已登录(带 JWT) */
|
||||
/** 获取授权跳转 URL;bind 模式要求已登录 */
|
||||
export function getOauthAuthorizeUrl(
|
||||
provider: string,
|
||||
mode: 'login' | 'bind',
|
||||
@@ -111,8 +121,9 @@ export function listIdentities(): Promise<{ items: UserIdentityInfo[] }> {
|
||||
return request('/auth/identities')
|
||||
}
|
||||
|
||||
export function unbindIdentity(id: number): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 300)
|
||||
/** 解绑外部身份;成功后旧 token 全部失效,响应带新会话 */
|
||||
export function unbindIdentity(id: number): Promise<SessionRefresh> {
|
||||
if (mockOn) return mocked({ token: 'mock-token-2', expiresAt: '2099-01-01T00:00:00Z' }, 300)
|
||||
return request(`/auth/identities/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
|
||||
+29
-1
@@ -1,6 +1,13 @@
|
||||
import { mockLogEvents, mockLogRelays, mockLogWebhooks } from './mock'
|
||||
import { mockOn, mocked, request } from './request'
|
||||
import type { LogEventPage, LogRelayView, LogWebhookInfo, LogWebhookState } from '@/types/api'
|
||||
import type {
|
||||
AlertRule,
|
||||
AlertRuleBody,
|
||||
LogEventPage,
|
||||
LogRelayView,
|
||||
LogWebhookInfo,
|
||||
LogWebhookState,
|
||||
} from '@/types/api'
|
||||
|
||||
export interface LogEventParams {
|
||||
page: number
|
||||
@@ -23,6 +30,27 @@ export function listLogEvents(params: LogEventParams): Promise<LogEventPage> {
|
||||
return request('/log-events', { query: { ...params } })
|
||||
}
|
||||
|
||||
// ---- 告警规则 ----
|
||||
export function listAlertRules(): Promise<AlertRule[]> {
|
||||
if (mockOn) return mocked([])
|
||||
return request<{ items: AlertRule[] }>('/log-events/alert-rules').then((r) => r.items)
|
||||
}
|
||||
|
||||
export function createAlertRule(body: AlertRuleBody): Promise<AlertRule> {
|
||||
if (mockOn) return mocked({ ...body, id: 1, createdAt: '', updatedAt: '' }, 300)
|
||||
return request('/log-events/alert-rules', { method: 'POST', body })
|
||||
}
|
||||
|
||||
export function updateAlertRule(id: number, body: AlertRuleBody): Promise<AlertRule> {
|
||||
if (mockOn) return mocked({ ...body, id, createdAt: '', updatedAt: '' }, 300)
|
||||
return request(`/log-events/alert-rules/${id}`, { method: 'PUT', body })
|
||||
}
|
||||
|
||||
export function deleteAlertRule(id: number): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 300)
|
||||
return request(`/log-events/alert-rules/${id}`, { method: 'DELETE' })
|
||||
}
|
||||
|
||||
export function getLogWebhook(cfgId: number): Promise<LogWebhookState> {
|
||||
if (mockOn) {
|
||||
const info = mockLogWebhooks.get(cfgId)
|
||||
|
||||
+3
-1
@@ -15,6 +15,8 @@ interface RequestOptions {
|
||||
method?: string
|
||||
body?: unknown
|
||||
query?: Record<string, string | number | boolean | undefined>
|
||||
/** 附加请求头 */
|
||||
headers?: Record<string, string>
|
||||
}
|
||||
|
||||
function buildUrl(path: string, query?: RequestOptions['query']): string {
|
||||
@@ -46,7 +48,7 @@ async function parseError(resp: Response): Promise<never> {
|
||||
/** 统一请求封装:注入 JWT、401 登出、错误转 ApiError */
|
||||
export async function request<T>(path: string, opts: RequestOptions = {}): Promise<T> {
|
||||
const auth = useAuthStore()
|
||||
const headers: Record<string, string> = { 'Content-Type': 'application/json' }
|
||||
const headers: Record<string, string> = { 'Content-Type': 'application/json', ...opts.headers }
|
||||
if (auth.token) headers.Authorization = `Bearer ${auth.token}`
|
||||
const resp = await fetch(buildUrl(path, opts.query), {
|
||||
method: opts.method ?? 'GET',
|
||||
|
||||
@@ -8,12 +8,15 @@ import {
|
||||
import { mockOn, mocked, request } from './request'
|
||||
import type {
|
||||
AboutInfo,
|
||||
NotifyChannelItem,
|
||||
NotifyChannelType,
|
||||
NotifyEventsSetting,
|
||||
NotifyTemplateItem,
|
||||
SecuritySetting,
|
||||
SystemLogPage,
|
||||
TaskSetting,
|
||||
TelegramSetting,
|
||||
UpdateNotifyChannelBody,
|
||||
} from '@/types/api'
|
||||
|
||||
export function getTelegramSetting(): Promise<TelegramSetting> {
|
||||
@@ -46,6 +49,37 @@ export function testTelegram(): Promise<void> {
|
||||
return request('/settings/telegram/test', { method: 'POST' })
|
||||
}
|
||||
|
||||
/** 通知渠道(webhook/ntfy/bark/smtp)脱敏视图列表 */
|
||||
export function listNotifyChannels(): Promise<NotifyChannelItem[]> {
|
||||
if (mockOn)
|
||||
return mocked(
|
||||
(['webhook', 'ntfy', 'bark', 'smtp'] as NotifyChannelType[]).map((type) => ({
|
||||
type,
|
||||
enabled: false,
|
||||
secretSet: false,
|
||||
})),
|
||||
)
|
||||
return request<{ items: NotifyChannelItem[] }>('/settings/notify-channels').then((r) => r.items)
|
||||
}
|
||||
|
||||
/** 保存单渠道配置,返回全渠道最新视图 */
|
||||
export function updateNotifyChannel(
|
||||
type: NotifyChannelType,
|
||||
body: UpdateNotifyChannelBody,
|
||||
): Promise<NotifyChannelItem[]> {
|
||||
if (mockOn) return mocked([], 400)
|
||||
return request<{ items: NotifyChannelItem[] }>(`/settings/notify-channels/${type}`, {
|
||||
method: 'PUT',
|
||||
body,
|
||||
}).then((r) => r.items)
|
||||
}
|
||||
|
||||
/** 向指定渠道发送测试消息(用已保存配置,不看启用开关) */
|
||||
export function testNotifyChannel(type: NotifyChannelType): Promise<void> {
|
||||
if (mockOn) return mocked(undefined, 800)
|
||||
return request(`/settings/notify-channels/${type}/test`, { method: 'POST' })
|
||||
}
|
||||
|
||||
export function getNotifyEvents(): Promise<NotifyEventsSetting> {
|
||||
if (mockOn) return mocked({ ...mockNotifyEvents })
|
||||
return request('/settings/notify-events')
|
||||
|
||||
+61
-48
@@ -14,6 +14,7 @@ import { mockOn, mocked, request } from './request'
|
||||
import type {
|
||||
AuditEventsResult,
|
||||
IamUser,
|
||||
IdentityDomain,
|
||||
IamUserDetail,
|
||||
IdentityProvider,
|
||||
IdentitySetting,
|
||||
@@ -83,14 +84,25 @@ export function getSubscription(id: number, subscriptionId: string): Promise<Sub
|
||||
return request(`/oci-configs/${id}/subscriptions/${subscriptionId}`)
|
||||
}
|
||||
|
||||
// ---- 身份域 ----
|
||||
/** 租户 ACTIVE 身份域列表;空数组表示无域老租户(隐藏选择器走经典路径) */
|
||||
export function listIdentityDomains(id: number): Promise<IdentityDomain[]> {
|
||||
if (mockOn)
|
||||
return mocked([
|
||||
{ id: 'ocid1.domain.default', displayName: 'Default', homeRegion: 'us-phoenix-1', type: 'DEFAULT', licenseType: 'free' },
|
||||
{ id: 'ocid1.domain.idcs', displayName: 'OracleIdentityCloudService', homeRegion: 'us-phoenix-1', type: 'SECONDARY', licenseType: 'idcs-foundation' },
|
||||
])
|
||||
return request(`/oci-configs/${id}/domains`)
|
||||
}
|
||||
|
||||
// ---- 用户 ----
|
||||
export function listUsers(id: number): Promise<IamUser[]> {
|
||||
export function listUsers(id: number, domainId?: string): Promise<IamUser[]> {
|
||||
if (mockOn) return mocked(mockUsers)
|
||||
return request(`/oci-configs/${id}/users`)
|
||||
return request(`/oci-configs/${id}/users`, { query: { domainId } })
|
||||
}
|
||||
|
||||
// 编辑表单预填充用;不在身份域的经典用户返回 inDomain: false
|
||||
export function getUserDetail(id: number, userId: string): Promise<IamUserDetail> {
|
||||
export function getUserDetail(id: number, userId: string, domainId?: string): Promise<IamUserDetail> {
|
||||
if (mockOn)
|
||||
return mocked(
|
||||
mockUserDetails[userId] ?? {
|
||||
@@ -101,7 +113,7 @@ export function getUserDetail(id: number, userId: string): Promise<IamUserDetail
|
||||
inAdminGroup: false,
|
||||
},
|
||||
)
|
||||
return request(`/oci-configs/${id}/users/${userId}`)
|
||||
return request(`/oci-configs/${id}/users/${userId}`, { query: { domainId } })
|
||||
}
|
||||
|
||||
export interface CreateUserBody {
|
||||
@@ -115,10 +127,10 @@ export interface CreateUserBody {
|
||||
addToAdminGroup?: boolean
|
||||
}
|
||||
|
||||
export function createUser(id: number, body: CreateUserBody): Promise<IamUser> {
|
||||
export function createUser(id: number, body: CreateUserBody, domainId?: string): Promise<IamUser> {
|
||||
if (mockOn)
|
||||
return mocked({ ...mockUsers[2], id: 'ocid1.user..new', name: body.name, email: body.email ?? '' })
|
||||
return request(`/oci-configs/${id}/users`, { method: 'POST', body })
|
||||
return request(`/oci-configs/${id}/users`, { method: 'POST', body, query: { domainId } })
|
||||
}
|
||||
|
||||
export interface UpdateUserBody {
|
||||
@@ -131,29 +143,29 @@ export interface UpdateUserBody {
|
||||
addToAdminGroup?: boolean
|
||||
}
|
||||
|
||||
export function updateUser(id: number, userId: string, body: UpdateUserBody): Promise<IamUser> {
|
||||
export function updateUser(id: number, userId: string, body: UpdateUserBody, domainId?: string): Promise<IamUser> {
|
||||
if (mockOn) {
|
||||
const u = mockUsers.find((x) => x.id === userId) ?? mockUsers[2]
|
||||
if (body.description !== undefined) u.description = body.description
|
||||
if (body.email !== undefined) u.email = body.email
|
||||
return mocked({ ...u })
|
||||
}
|
||||
return request(`/oci-configs/${id}/users/${userId}`, { method: 'PUT', body })
|
||||
return request(`/oci-configs/${id}/users/${userId}`, { method: 'PUT', body, query: { domainId } })
|
||||
}
|
||||
|
||||
export function deleteUser(id: number, userId: string): Promise<void> {
|
||||
export function deleteUser(id: number, userId: string, domainId?: string): Promise<void> {
|
||||
if (mockOn) return mocked(undefined)
|
||||
return request(`/oci-configs/${id}/users/${userId}`, { method: 'DELETE' })
|
||||
return request(`/oci-configs/${id}/users/${userId}`, { method: 'DELETE', query: { domainId } })
|
||||
}
|
||||
|
||||
export function resetUserPassword(id: number, userId: string): Promise<{ password: string }> {
|
||||
export function resetUserPassword(id: number, userId: string, domainId?: string): Promise<{ password: string }> {
|
||||
if (mockOn) return mocked({ password: 'Xy9#kQ2m$Lp8' })
|
||||
return request(`/oci-configs/${id}/users/${userId}/reset-password`, { method: 'POST' })
|
||||
return request(`/oci-configs/${id}/users/${userId}/reset-password`, { method: 'POST', query: { domainId } })
|
||||
}
|
||||
|
||||
export function clearUserMfa(id: number, userId: string): Promise<{ deletedTotpDevices: number }> {
|
||||
export function clearUserMfa(id: number, userId: string, domainId?: string): Promise<{ deletedTotpDevices: number }> {
|
||||
if (mockOn) return mocked({ deletedTotpDevices: 1 })
|
||||
return request(`/oci-configs/${id}/users/${userId}/mfa-devices`, { method: 'DELETE' })
|
||||
return request(`/oci-configs/${id}/users/${userId}/mfa-devices`, { method: 'DELETE', query: { domainId } })
|
||||
}
|
||||
|
||||
export function deleteUserApiKeys(
|
||||
@@ -169,26 +181,19 @@ export function deleteUserApiKeys(
|
||||
}
|
||||
|
||||
// ---- 审计日志 ----
|
||||
/** 实时查询租户 OCI 审计事件:hours ∈ [1,72] 首查;
|
||||
* 截断续查传上次响应的 start/end 与 nextPage(绝对窗+游标断点续翻) */
|
||||
/** 批式懒加载查询审计事件:cursor 空自当前时刻首查,
|
||||
* 非空从上次响应游标向更早续取一批(~100 条,服务端分窗回溯) */
|
||||
export function listAuditEvents(
|
||||
id: number,
|
||||
opts: { hours?: number; region?: string; start?: string; end?: string; page?: string } = {},
|
||||
opts: { region?: string; cursor?: string; limit?: number } = {},
|
||||
): Promise<AuditEventsResult> {
|
||||
// mock 下选 1 小时窗演示截断提示
|
||||
// mock:首批带游标,续查一批后到尽头,演示懒加载链路
|
||||
if (mockOn)
|
||||
return mocked(
|
||||
{
|
||||
items: mockAuditEvents,
|
||||
truncated: opts.hours === 1,
|
||||
start: '2026-07-06T10:00:00Z',
|
||||
end: '2026-07-07T10:00:00Z',
|
||||
},
|
||||
{ items: mockAuditEvents, cursor: opts.cursor ? undefined : 'mock-cursor', exhausted: !!opts.cursor },
|
||||
300,
|
||||
)
|
||||
const { hours = 24, region, start, end, page } = opts
|
||||
const query = start && end ? { region, start, end, page } : { hours, region }
|
||||
return request(`/oci-configs/${id}/audit-events`, { query })
|
||||
return request(`/oci-configs/${id}/audit-events`, { query: { ...opts } })
|
||||
}
|
||||
|
||||
/** 取回单条审计事件的原始 JSON;404 表示缓存过期且重查未找回(前端降级展示精简字段) */
|
||||
@@ -201,45 +206,49 @@ export function getAuditEventDetail(
|
||||
}
|
||||
|
||||
// ---- 域设置 ----
|
||||
export function getNotificationRecipients(id: number): Promise<NotificationRecipients> {
|
||||
export function getNotificationRecipients(id: number, domainId?: string): Promise<NotificationRecipients> {
|
||||
if (mockOn) return mocked(mockRecipients)
|
||||
return request(`/oci-configs/${id}/notification-recipients`)
|
||||
return request(`/oci-configs/${id}/notification-recipients`, { query: { domainId } })
|
||||
}
|
||||
|
||||
export function updateNotificationRecipients(
|
||||
id: number,
|
||||
recipients: string[],
|
||||
domainId?: string,
|
||||
): Promise<NotificationRecipients> {
|
||||
if (mockOn) return mocked({ recipients, testModeEnabled: recipients.length > 0 })
|
||||
return request(`/oci-configs/${id}/notification-recipients`, {
|
||||
method: 'PUT',
|
||||
body: { recipients },
|
||||
query: { domainId },
|
||||
})
|
||||
}
|
||||
|
||||
export function listPasswordPolicies(id: number): Promise<PasswordPolicy[]> {
|
||||
export function listPasswordPolicies(id: number, domainId?: string): Promise<PasswordPolicy[]> {
|
||||
if (mockOn) return mocked(mockPolicies)
|
||||
return request(`/oci-configs/${id}/password-policies`)
|
||||
return request(`/oci-configs/${id}/password-policies`, { query: { domainId } })
|
||||
}
|
||||
|
||||
export function updatePasswordPolicy(
|
||||
id: number,
|
||||
policyId: string,
|
||||
body: { passwordExpiresAfter?: number; minLength?: number; numPasswordsInHistory?: number },
|
||||
domainId?: string,
|
||||
): Promise<PasswordPolicy> {
|
||||
if (mockOn) return mocked({ ...mockPolicies[0], ...body })
|
||||
return request(`/oci-configs/${id}/password-policies/${policyId}`, { method: 'PUT', body })
|
||||
return request(`/oci-configs/${id}/password-policies/${policyId}`, { method: 'PUT', body, query: { domainId } })
|
||||
}
|
||||
|
||||
// ---- 身份设置 ----
|
||||
export function getIdentitySetting(id: number): Promise<IdentitySetting> {
|
||||
export function getIdentitySetting(id: number, domainId?: string): Promise<IdentitySetting> {
|
||||
if (mockOn) return mocked({ ...mockIdentitySetting })
|
||||
return request(`/oci-configs/${id}/identity-settings`)
|
||||
return request(`/oci-configs/${id}/identity-settings`, { query: { domainId } })
|
||||
}
|
||||
|
||||
export function updateIdentitySetting(
|
||||
id: number,
|
||||
primaryEmailRequired: boolean,
|
||||
domainId?: string,
|
||||
): Promise<IdentitySetting> {
|
||||
if (mockOn) {
|
||||
mockIdentitySetting.primaryEmailRequired = primaryEmailRequired
|
||||
@@ -248,10 +257,11 @@ export function updateIdentitySetting(
|
||||
return request(`/oci-configs/${id}/identity-settings`, {
|
||||
method: 'PUT',
|
||||
body: { primaryEmailRequired },
|
||||
query: { domainId },
|
||||
})
|
||||
}
|
||||
|
||||
export async function downloadSamlMetadata(id: number): Promise<void> {
|
||||
export async function downloadSamlMetadata(id: number, domainId?: string): Promise<void> {
|
||||
if (mockOn) {
|
||||
const blob = new Blob(['<mock-saml-metadata/>'], { type: 'application/xml' })
|
||||
triggerDownload(blob, 'oci-domain-saml-metadata.xml')
|
||||
@@ -259,7 +269,8 @@ export async function downloadSamlMetadata(id: number): Promise<void> {
|
||||
}
|
||||
const { useAuthStore } = await import('@/stores/auth')
|
||||
const auth = useAuthStore()
|
||||
const resp = await fetch(`/api/v1/oci-configs/${id}/saml-metadata`, {
|
||||
const qs = domainId ? `?domainId=${encodeURIComponent(domainId)}` : ''
|
||||
const resp = await fetch(`/api/v1/oci-configs/${id}/saml-metadata${qs}`, {
|
||||
headers: auth.token ? { Authorization: `Bearer ${auth.token}` } : {},
|
||||
})
|
||||
if (!resp.ok) throw new Error(`下载失败(${resp.status})`)
|
||||
@@ -293,7 +304,7 @@ export interface CreateIdpBody {
|
||||
jitMapEmail?: boolean
|
||||
}
|
||||
|
||||
export function createIdp(id: number, body: CreateIdpBody): Promise<IdentityProvider> {
|
||||
export function createIdp(id: number, body: CreateIdpBody, domainId?: string): Promise<IdentityProvider> {
|
||||
if (mockOn) {
|
||||
const created = {
|
||||
...mockIdps[1],
|
||||
@@ -304,41 +315,43 @@ export function createIdp(id: number, body: CreateIdpBody): Promise<IdentityProv
|
||||
mockIdps.push(created)
|
||||
return mocked(created, 900)
|
||||
}
|
||||
return request(`/oci-configs/${id}/identity-providers`, { method: 'POST', body })
|
||||
return request(`/oci-configs/${id}/identity-providers`, { method: 'POST', body, query: { domainId } })
|
||||
}
|
||||
|
||||
export function listIdps(id: number): Promise<IdentityProvider[]> {
|
||||
export function listIdps(id: number, domainId?: string): Promise<IdentityProvider[]> {
|
||||
if (mockOn) return mocked(mockIdps)
|
||||
return request(`/oci-configs/${id}/identity-providers`)
|
||||
return request(`/oci-configs/${id}/identity-providers`, { query: { domainId } })
|
||||
}
|
||||
|
||||
export function activateIdp(id: number, idpId: string, enabled: boolean): Promise<IdentityProvider> {
|
||||
export function activateIdp(id: number, idpId: string, enabled: boolean, domainId?: string): Promise<IdentityProvider> {
|
||||
if (mockOn) return mocked({ ...mockIdps[0], enabled })
|
||||
return request(`/oci-configs/${id}/identity-providers/${idpId}/activate`, {
|
||||
method: 'POST',
|
||||
body: { enabled },
|
||||
query: { domainId },
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteIdp(id: number, idpId: string): Promise<void> {
|
||||
export function deleteIdp(id: number, idpId: string, domainId?: string): Promise<void> {
|
||||
if (mockOn) return mocked(undefined)
|
||||
return request(`/oci-configs/${id}/identity-providers/${idpId}`, { method: 'DELETE' })
|
||||
return request(`/oci-configs/${id}/identity-providers/${idpId}`, { method: 'DELETE', query: { domainId } })
|
||||
}
|
||||
|
||||
export function listSignOnRules(id: number): Promise<SignOnRule[]> {
|
||||
export function listSignOnRules(id: number, domainId?: string): Promise<SignOnRule[]> {
|
||||
if (mockOn) return mocked(mockSignOnRules)
|
||||
return request(`/oci-configs/${id}/sign-on-rules`)
|
||||
return request(`/oci-configs/${id}/sign-on-rules`, { query: { domainId } })
|
||||
}
|
||||
|
||||
export function createSignOnExemption(id: number, identityProviderId: string): Promise<SignOnRule> {
|
||||
export function createSignOnExemption(id: number, identityProviderId: string, domainId?: string): Promise<SignOnRule> {
|
||||
if (mockOn) return mocked(mockSignOnRules[0])
|
||||
return request(`/oci-configs/${id}/sign-on-exemptions`, {
|
||||
method: 'POST',
|
||||
body: { identityProviderId },
|
||||
query: { domainId },
|
||||
})
|
||||
}
|
||||
|
||||
export function deleteSignOnExemption(id: number, ruleId: string): Promise<void> {
|
||||
export function deleteSignOnExemption(id: number, ruleId: string, domainId?: string): Promise<void> {
|
||||
if (mockOn) return mocked(undefined)
|
||||
return request(`/oci-configs/${id}/sign-on-exemptions/${ruleId}`, { method: 'DELETE' })
|
||||
return request(`/oci-configs/${id}/sign-on-exemptions/${ruleId}`, { method: 'DELETE', query: { domainId } })
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user