mirror of
https://github.com/dbeaver/cloudbeaver.git
synced 2026-09-24 16:04:36 +08:00
fix(plugin-authentication): CB-1001 add AdminRoleInfo fragment
This commit is contained in:
@@ -9,18 +9,18 @@
|
||||
import { injectable } from '@cloudbeaver/core-di';
|
||||
import {
|
||||
GraphQLService,
|
||||
AdminRoleInfo,
|
||||
CachedMapResource,
|
||||
ResourceKey,
|
||||
resourceKeyList,
|
||||
ResourceKeyList,
|
||||
ResourceKeyUtils
|
||||
ResourceKeyUtils,
|
||||
AdminRoleInfoFragment
|
||||
} from '@cloudbeaver/core-sdk';
|
||||
import { MetadataMap } from '@cloudbeaver/core-utils';
|
||||
|
||||
const NEW_ROLE_SYMBOL = Symbol('new-role');
|
||||
|
||||
export type RoleInfo = Pick<AdminRoleInfo, 'roleId' | 'roleName' | 'description'>;
|
||||
export type RoleInfo = AdminRoleInfoFragment;
|
||||
type NewRole = RoleInfo & { [NEW_ROLE_SYMBOL]: boolean; timestamp: number };
|
||||
|
||||
@injectable()
|
||||
|
||||
@@ -1,8 +1,5 @@
|
||||
query createRole($roleId: ID!, $roleName: String, $description: String ) {
|
||||
role: createRole(roleId: $roleId, roleName: $roleName, description: $description) {
|
||||
roleId,
|
||||
roleName,
|
||||
description,
|
||||
#rolePermissions
|
||||
...AdminRoleInfo
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
query getRolesList($roleId: ID) {
|
||||
roles: listRoles(roleId: $roleId) {
|
||||
roleId
|
||||
roleName
|
||||
description
|
||||
# rolePermissions
|
||||
...AdminRoleInfo
|
||||
}
|
||||
}
|
||||
@@ -1,8 +1,5 @@
|
||||
query updateRole($roleId: ID!, $roleName: String, $description: String ) {
|
||||
role: updateRole(roleId: $roleId, roleName: $roleName, description: $description) {
|
||||
roleId,
|
||||
roleName,
|
||||
description,
|
||||
# rolePermissions
|
||||
...AdminRoleInfo
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
fragment AdminRoleInfo on AdminRoleInfo {
|
||||
roleId
|
||||
roleName
|
||||
description
|
||||
}
|
||||
@@ -1116,7 +1116,7 @@ export type CreateRoleQueryVariables = Exact<{
|
||||
description?: Maybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
export interface CreateRoleQuery { role: Pick<AdminRoleInfo, 'roleId' | 'roleName' | 'description'> }
|
||||
export interface CreateRoleQuery { role: AdminRoleInfoFragment }
|
||||
|
||||
export type DeleteRoleQueryVariables = Exact<{
|
||||
roleId: Scalars['ID'];
|
||||
@@ -1128,7 +1128,7 @@ export type GetRolesListQueryVariables = Exact<{
|
||||
roleId?: Maybe<Scalars['ID']>;
|
||||
}>;
|
||||
|
||||
export interface GetRolesListQuery { roles: Array<Maybe<Pick<AdminRoleInfo, 'roleId' | 'roleName' | 'description'>>> }
|
||||
export interface GetRolesListQuery { roles: Array<Maybe<AdminRoleInfoFragment>> }
|
||||
|
||||
export type UpdateRoleQueryVariables = Exact<{
|
||||
roleId: Scalars['ID'];
|
||||
@@ -1136,7 +1136,7 @@ export type UpdateRoleQueryVariables = Exact<{
|
||||
description?: Maybe<Scalars['String']>;
|
||||
}>;
|
||||
|
||||
export interface UpdateRoleQuery { role: Pick<AdminRoleInfo, 'roleId' | 'roleName' | 'description'> }
|
||||
export interface UpdateRoleQuery { role: AdminRoleInfoFragment }
|
||||
|
||||
export type AuthChangeLocalPasswordQueryVariables = Exact<{
|
||||
oldPassword: Scalars['String'];
|
||||
@@ -1569,6 +1569,8 @@ export type NavGetStructContainersQueryVariables = Exact<{
|
||||
|
||||
export interface NavGetStructContainersQuery { navGetStructContainers: { catalogList: Array<Pick<DatabaseObjectInfo, 'name' | 'description' | 'type' | 'features'>>; schemaList: Array<Pick<DatabaseObjectInfo, 'name' | 'description' | 'type' | 'features'>> } }
|
||||
|
||||
export type AdminRoleInfoFragment = Pick<AdminRoleInfo, 'roleId' | 'roleName' | 'description'>;
|
||||
|
||||
export type AdminUserInfoFragment = (
|
||||
Pick<AdminUserInfo, 'userId' | 'grantedRoles' | 'linkedAuthProviders'>
|
||||
& { origins: ObjectOriginInfoFragment[] }
|
||||
@@ -1870,6 +1872,13 @@ export type SqlResultCloseMutationVariables = Exact<{
|
||||
|
||||
export interface SqlResultCloseMutation { result: Mutation['sqlResultClose'] }
|
||||
|
||||
export const AdminRoleInfoFragmentDoc = `
|
||||
fragment AdminRoleInfo on AdminRoleInfo {
|
||||
roleId
|
||||
roleName
|
||||
description
|
||||
}
|
||||
`;
|
||||
export const ObjectOriginInfoFragmentDoc = `
|
||||
fragment ObjectOriginInfo on ObjectOrigin {
|
||||
type
|
||||
@@ -2102,12 +2111,10 @@ export const CreateRoleDocument = `
|
||||
roleName: $roleName
|
||||
description: $description
|
||||
) {
|
||||
roleId
|
||||
roleName
|
||||
description
|
||||
...AdminRoleInfo
|
||||
}
|
||||
}
|
||||
`;
|
||||
${AdminRoleInfoFragmentDoc}`;
|
||||
export const DeleteRoleDocument = `
|
||||
query deleteRole($roleId: ID!) {
|
||||
deleteRole(roleId: $roleId)
|
||||
@@ -2116,12 +2123,10 @@ export const DeleteRoleDocument = `
|
||||
export const GetRolesListDocument = `
|
||||
query getRolesList($roleId: ID) {
|
||||
roles: listRoles(roleId: $roleId) {
|
||||
roleId
|
||||
roleName
|
||||
description
|
||||
...AdminRoleInfo
|
||||
}
|
||||
}
|
||||
`;
|
||||
${AdminRoleInfoFragmentDoc}`;
|
||||
export const UpdateRoleDocument = `
|
||||
query updateRole($roleId: ID!, $roleName: String, $description: String) {
|
||||
role: updateRole(
|
||||
@@ -2129,12 +2134,10 @@ export const UpdateRoleDocument = `
|
||||
roleName: $roleName
|
||||
description: $description
|
||||
) {
|
||||
roleId
|
||||
roleName
|
||||
description
|
||||
...AdminRoleInfo
|
||||
}
|
||||
}
|
||||
`;
|
||||
${AdminRoleInfoFragmentDoc}`;
|
||||
export const AuthChangeLocalPasswordDocument = `
|
||||
query authChangeLocalPassword($oldPassword: String!, $newPassword: String!) {
|
||||
authChangeLocalPassword(oldPassword: $oldPassword, newPassword: $newPassword)
|
||||
|
||||
@@ -12,8 +12,7 @@ export function isMapsEqual(map1: Map<any, any>, map2: Map<any, any>): boolean {
|
||||
}
|
||||
|
||||
for (const [key, value] of map1) {
|
||||
const val = map2.get(key);
|
||||
if (val !== value || (val === undefined && !map2.has(key))) {
|
||||
if (!map2.has(key) || map2.get(key) !== value) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user