generated from autonomic-cooperative/astro-payload-template
Collection access tweaks
This commit is contained in:
parent
691729c53c
commit
b91dd893a4
@ -1,3 +1,4 @@
|
|||||||
|
import { isUser } from "@/access/isUser";
|
||||||
import { CollectionConfig } from "payload/types";
|
import { CollectionConfig } from "payload/types";
|
||||||
|
|
||||||
export const Media: CollectionConfig = {
|
export const Media: CollectionConfig = {
|
||||||
@ -5,15 +6,15 @@ export const Media: CollectionConfig = {
|
|||||||
admin: {},
|
admin: {},
|
||||||
access: {
|
access: {
|
||||||
read: (): boolean => true,
|
read: (): boolean => true,
|
||||||
create: () => true,
|
create: isUser,
|
||||||
update: () => true,
|
update: isUser,
|
||||||
|
delete: isUser,
|
||||||
},
|
},
|
||||||
upload: {
|
upload: {
|
||||||
staticURL: "/media",
|
staticURL: "/media",
|
||||||
staticDir: "media",
|
staticDir: "media",
|
||||||
mimeTypes: ["image/*"],
|
mimeTypes: ["image/*"],
|
||||||
},
|
},
|
||||||
|
|
||||||
fields: [
|
fields: [
|
||||||
{
|
{
|
||||||
name: "alt",
|
name: "alt",
|
||||||
|
@ -6,6 +6,7 @@ const Users: CollectionConfig = {
|
|||||||
slug: 'users',
|
slug: 'users',
|
||||||
auth: true,
|
auth: true,
|
||||||
admin: {
|
admin: {
|
||||||
|
defaultColumns: ["roles", "email"],
|
||||||
useAsTitle: 'email',
|
useAsTitle: 'email',
|
||||||
},
|
},
|
||||||
access: {
|
access: {
|
||||||
@ -22,7 +23,7 @@ const Users: CollectionConfig = {
|
|||||||
{ label: 'ssg', value: 'ssg' }, //cRud
|
{ label: 'ssg', value: 'ssg' }, //cRud
|
||||||
{ label: 'Admin', value: 'admin' }, //CRUD, role creation
|
{ label: 'Admin', value: 'admin' }, //CRUD, role creation
|
||||||
{ label: 'Editor', value: 'editor' }, //CRUD
|
{ label: 'Editor', value: 'editor' }, //CRUD
|
||||||
{ label: 'User', value: 'user' }, //CRUd
|
{ label: 'User', value: 'user' }, //cRud, CRUD own entries
|
||||||
],
|
],
|
||||||
required: true,
|
required: true,
|
||||||
defaultValue: "user",
|
defaultValue: "user",
|
||||||
|
Loading…
Reference in New Issue
Block a user