71 Commits

Author SHA1 Message Date
Jarrod Flesch
00667faf8d feat: folders (#10030) 2025-05-22 10:04:45 -04:00
Jacob Fletcher
9779cf7f7d feat: prevent query preset lockout (#12322)
Prevents an accidental lockout of query preset documents. An "accidental
lockout" occurs when the user sets access control on a preset and
excludes themselves. This can happen in a variety of scenarios,
including:

 - You select `specificUsers` without specifying yourself
- You select `specificRoles` without specifying a role that you are a
part of
 - Etc.

#### How it works

To make this happen, we use a custom validation function that executes
access against the user's proposed changes. If those changes happen to
remove access for them, we throw a validation error and prevent that
change from ever taking place. This means that only a user with proper
access can remove another user from the preset. You cannot remove
yourself.

To do this, we create a temporary record in the database that we can
query against. We use transactions to ensure that the temporary record
is not persisted once our work is completed. Since not all Payload
projects have transactions enabled, we flag these temporary records with
the `isTemp` field.

Once created, we query the temp document to determine its permissions.
If any of the operations throw an error, this means the user can no
longer act on them, and we throw a validation error.

#### Alternative Approach
 
A previous approach that was explored was to add an `owner` field to the
presets collection. This way, the "owner" of the preset would be able to
completely bypass all access control, effectively eliminating the
possibility of a lockout event.

But this doesn't work for other users who may have update access. E.g.
they could still accidentally remove themselves from the read or update
operation, preventing them from accessing that preset after submitting
the form. We need a solution that works for all users, not just the
owner.
2025-05-14 19:25:32 +00:00
Paul
dfdea0d4eb chore: update vscode launch settings for debugging test suites (#8399) 2024-09-30 15:18:03 -04:00
Patrik
f98d032617 feat: lock documents while being edited (#7970)
## Description

Adds a new property to `collection` / `global` configs called
`lockDocuments`.

Set to `true` by default - the lock is automatically triggered when a
user begins editing a document within the Admin Panel and remains in
place until the user exits the editing view or the lock expires due to
inactivity.

Set to `false` to disable document locking entirely - i.e.
`lockDocuments: false`

You can pass an object to this property to configure the `duration` in
seconds, which defines how long the document remains locked without user
interaction. If no edits are made within the specified time (default:
300 seconds), the lock expires, allowing other users to edit / update or
delete the document.

```
lockDocuments: {
  duration: 180, // 180 seconds or 3 minutes
}
```

- [x] I have read and understand the
[CONTRIBUTING.md](https://github.com/payloadcms/payload/blob/main/CONTRIBUTING.md)
document in this repository.

## Type of change

- [x] New feature (non-breaking change which adds functionality)

## Checklist:

- [x] I have added tests that prove my fix is effective or that my
feature works
- [x] Existing test suite passes locally with my changes
- [x] I have made corresponding changes to the documentation
2024-09-17 14:04:48 -04:00
Patrik
62744e79ac fix(next, payload): enable relationship & upload version tracking when localization enabled (#7508) 2024-08-06 12:28:06 -04:00
Jarrod Flesch
442189ec48 fix: email and username fields rendering in drawers (#7520)
Fixes https://github.com/payloadcms/payload/issues/7428

Now email and username fields are rendered with the RenderFields
component, making them behave similarly to other fields. They now appear
and can respect doc permissions, readOnly settings, etc.
2024-08-05 20:18:32 -04:00
Jarrod Flesch
52c81ad525 feat: adds draft validation option (#6677)
## Description

Allows draft validation to be enabled at the config level.

You can enable this by:
```ts
// ...collectionConfig
versions: {
  drafts: {
    validate: true // defaults to false
  }
}
```
2024-06-07 15:22:03 -04:00
Elliot DeNolf
ed880d5018 feat: storage-uploadthing package (#6316)
Co-authored-by: James <james@trbl.design>
2024-05-10 17:05:35 -04:00
Jarrod Flesch
e25814e1ee fix: cascade graphql locales through relationships (#6166) 2024-05-03 08:33:53 -04:00
Jarrod Flesch
3db0557b07 chore: improve cookie helper functions (#5866) 2024-04-15 22:11:17 -04:00
James
3aab9d368e chore: working loader 2024-04-08 10:07:55 -04:00
James
630082035f chore: sets up test environment for loader 2024-04-07 19:48:42 -04:00
Alessio Gravili
3d3305a312 Merge remote-tracking branch 'origin/alpha' into fix/fields-e2e 2024-04-04 14:57:22 -04:00
James
5d57572694 chore: work to add consistency to fields e2e 2024-04-04 14:41:58 -04:00
Jacob Fletcher
7894a54a0e Merge branch 'alpha' into fix/alpha/admin-e2e 2024-04-04 10:02:37 -04:00
Jarrod Flesch
9f4ab26696 chore: passing admin/nav tests 2024-04-03 12:17:48 -04:00
James
f6bc3eb014 chore: passing pg 2024-04-03 10:39:38 -04:00
James
94d0e28ad7 chore: local api sdk for e2e tests 2024-04-01 21:53:30 -04:00
James
2f6a15a9ae chore: calculates default values before running buildFormState 2024-04-01 10:52:26 -04:00
Jacob Fletcher
a8082c551b fix(next): removes reliance on instanceof from api error formatting (#5482) 2024-03-27 09:06:47 -04:00
James
5eaea1c7f1 chore: moves live preview test suite into main app folder 2024-03-18 14:27:56 -04:00
James
d75bf235bb chore: builds esm register script 2024-03-08 11:16:55 -05:00
Jarrod Flesch
c73159d2d0 chore: adds qs, adds query to createPayloadRequest 2024-03-06 14:26:21 -05:00
James
df6fa0be24 chore: moves dev folder to top, establishes new test pattern 2024-02-14 15:58:03 -05:00
Jarrod Flesch
8b89767907 chore: adjusts file property on request type 2024-01-19 12:51:39 -05:00
Jacob Fletcher
5558e0c62f Merge branch 'main' into feat/next-poc 2023-12-19 10:34:34 -05:00
Jacob Fletcher
303f0d6227 chore(plugin-search): scaffolds tests (#4511) 2023-12-14 13:06:19 -05:00
Jacob Fletcher
77407f0879 Merge branch 'main' into feat/next-poc 2023-12-01 22:50:58 -05:00
Jacob Fletcher
2ad7340154 fix(live-preview): field recursion and relationship population (#4045) 2023-11-08 17:28:35 -05:00
Jarrod Flesch
acba5e482b fix: focal and cropping issues, adds test (#4039) 2023-11-07 15:20:57 -05:00
James
0996f8cccb chore: initial next poc 2023-11-07 13:59:59 -05:00
Jarrod Flesch
46fc41cbd9 fix: incorrect duplication of data in admin ui (#3907) 2023-10-27 22:41:33 -04:00
Elliot DeNolf
6cfa8a373e test: plugin cloud storage suite (#3884)
* chore: proper admin mock for adapters

* test: add plugin-cloud-storage dev
2023-10-26 09:35:49 -04:00
James
e6f0d35985 fix: #3541 2023-10-10 14:07:26 -04:00
Elliot DeNolf
cf26155995 chore: sync logger for prompts, adjust nodemon 2023-10-03 12:34:48 -04:00
Alessio Gravili
426efcaa08 chore: unbreak vscode config launch command 2023-10-02 23:32:15 +02:00
James
fa4821adef chore: add declare pattern to generated types 2023-10-02 10:45:19 -04:00
James
556620a94e chore: enables bundle analyzer in webpack 2023-10-01 18:55:01 -04:00
James
44b10cc9b4 chore: webpack published package bugs 2023-10-01 16:20:18 -04:00
James
e6a0ed5e1c chore: vite dev script 2023-10-01 15:07:21 -04:00
Elliot DeNolf
9c0aadd046 chore: migration dir and migration template updates 2023-09-25 23:27:58 -04:00
James
7fdf77cf3e chore: bugs with sort, graphql tests with postgres 2023-09-19 10:50:04 -04:00
Elliot DeNolf
79f9ef2481 chore: migration improvements (#3335)
* chore: better migrationDir handling

* chore: add .migrations to gitignore

* chore: migration cli debugging

* docs: stub out each migration command
2023-09-14 14:23:17 -04:00
Alessio Gravili
ae7d6f97d2 chore: formatting and linting (#3261)
* chore: lint packages/payload

* chore: lint packages/db-postgres

* chore: lint packages/db-mongodb

* chore: update eslintrc exclusion rules

* chore: update eslintrc exclusion rules

* chore: lint misc files

* chore: run prettier through packages

* chore: run eslint on payload again

* chore: prettier misc files

* chore: prettier docs
2023-09-01 17:39:44 +02:00
Alessio Gravili
e24ad67168 chore: migrate to pnpm 2023-08-23 00:21:11 +02:00
Elliot DeNolf
24aa1f27c1 feat: handle postgres numeric field for batch number comparison 2023-08-14 14:02:56 -04:00
Elliot DeNolf
791ed3be50 feat: conditionally use transactions 2023-08-10 13:54:04 -04:00
Elliot DeNolf
8685ca6e94 feat: dev push migrations handling and prompt 2023-08-07 16:23:02 -04:00
James
a1388630d0 chore: adds postgres test suite 2023-08-02 19:57:22 -04:00
James
f69e5949e1 chore: abstracts adapters to be their own package 2023-07-31 12:42:21 -04:00