basic search working
This commit is contained in:
@@ -8,7 +8,18 @@ export const Papers: CollectionConfig = {
|
||||
plural: 'Diplomarbeiten',
|
||||
},
|
||||
access: {
|
||||
create: ({ req: { user } }) => {
|
||||
return Boolean(user?.type == "admin") // <-- Check if the user is authenticated
|
||||
},
|
||||
delete: ({ req: { user } }) => {
|
||||
return Boolean(user?.type == "admin") // <-- Check if the user is authenticated
|
||||
},
|
||||
update: async ({ req: { user }, id, findByID }) => {
|
||||
if (user?.type == "admin") return true; // Admins can update any paper
|
||||
|
||||
const paper = await findByID({ collection: 'papers', id });
|
||||
return paper.authors.some(author => author.user === user.id); // Check if the user is an author
|
||||
},
|
||||
},
|
||||
admin: {
|
||||
useAsTitle: 'title',
|
||||
|
||||
Reference in New Issue
Block a user