Skip to content

Commit da7db15

Browse files
tsemachhjunie-agent
andcommitted
Fix ABAC CI type failures
Co-authored-by: Junie <junie@jetbrains.com>
1 parent 9b4b89f commit da7db15

2 files changed

Lines changed: 8 additions & 6 deletions

File tree

packages/abac/src/types.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -14,11 +14,11 @@ export type AttributeProvider<
1414
User extends AbacUser = AbacUser,
1515
> = {
1616
key: string
17-
fromUser: (user: User, req: PayloadRequest) => UserValue | Promise<UserValue>
17+
fromUser(user: User, req: PayloadRequest): UserValue | Promise<UserValue>
1818
fromDoc?: Partial<Record<CollectionSlug, (doc: AbacDocument) => DocumentValue>>
19-
match: (userValue: UserValue, docValue: DocumentValue) => boolean | Promise<boolean>
20-
toWhere?: (userValue: UserValue) => Where
21-
enrichJWT?: (user: User) => Record<string, unknown> | Promise<Record<string, unknown>>
19+
match(userValue: UserValue, docValue: DocumentValue): boolean | Promise<boolean>
20+
toWhere?(userValue: UserValue): Where
21+
enrichJWT?(user: User): Record<string, unknown> | Promise<Record<string, unknown>>
2222
}
2323

2424
export type AbacCollectionAttributeConfig = {

test-app/src/seed.ts

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
import type { Payload } from 'payload'
22

3+
import type { RolePermissions } from './payload-types'
4+
35
export const adminUser = {
46
email: 'admin@payload-tools.dev',
57
password: 'Password1!',
@@ -22,10 +24,10 @@ export const seed = async (payload: Payload) => {
2224
// ── Roles ───────────────────────────────────────────────────────────────────
2325
let adminRoleId: string | undefined
2426
let editorRoleId: string | undefined
25-
const editorPermissions = [
27+
const editorPermissions: RolePermissions = [
2628
{ entity: ['articles', 'pages'], type: ['read', 'write', 'publish'] },
2729
]
28-
const viewerPermissions = [{ entity: ['articles', 'pages'], type: ['read'] }]
30+
const viewerPermissions: RolePermissions = [{ entity: ['articles', 'pages'], type: ['read'] }]
2931
const { totalDocs: roleCount } = await payload.count({ collection: 'roles', overrideAccess: true })
3032
if (!roleCount) {
3133
const adminRole = await payload.create({

0 commit comments

Comments
 (0)