mirror of
https://github.com/toeverything/AFFiNE.git
synced 2024-12-18 04:42:41 +03:00
fix(server): everyone can share page in workspace (#4357)
This commit is contained in:
parent
1016a47b51
commit
f0de34a60b
@ -30,7 +30,6 @@ import type { User, Workspace } from '@prisma/client';
|
||||
import GraphQLUpload from 'graphql-upload/GraphQLUpload.mjs';
|
||||
import { applyUpdate, Doc } from 'yjs';
|
||||
|
||||
import { Config } from '../../config';
|
||||
import { PrismaService } from '../../prisma';
|
||||
import { StorageProvide } from '../../storage';
|
||||
import { CloudThrottlerGuard, Throttle } from '../../throttler';
|
||||
@ -139,7 +138,6 @@ export class WorkspaceResolver {
|
||||
|
||||
constructor(
|
||||
private readonly auth: AuthService,
|
||||
private readonly config: Config,
|
||||
private readonly mailer: MailService,
|
||||
private readonly prisma: PrismaService,
|
||||
private readonly permissions: PermissionService,
|
||||
@ -644,9 +642,16 @@ export class WorkspaceResolver {
|
||||
@Args('workspaceId') workspaceId: string,
|
||||
@Args('pageId') pageId: string
|
||||
) {
|
||||
await this.permissions.check(workspaceId, user.id, Permission.Admin);
|
||||
|
||||
return this.permissions.grantPage(workspaceId, pageId);
|
||||
const userWorkspace = await this.prisma.userWorkspacePermission.findFirst({
|
||||
where: {
|
||||
userId: user.id,
|
||||
workspaceId,
|
||||
},
|
||||
});
|
||||
return (
|
||||
userWorkspace?.accepted &&
|
||||
(await this.permissions.grantPage(workspaceId, pageId))
|
||||
);
|
||||
}
|
||||
|
||||
@Mutation(() => Boolean)
|
||||
|
Loading…
Reference in New Issue
Block a user