Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Album allow public upload but disallow deletion #2068

Closed
ethaniel86 opened this issue Dec 9, 2023 · 1 comment · Fixed by #2035
Closed

Album allow public upload but disallow deletion #2068

ethaniel86 opened this issue Dec 9, 2023 · 1 comment · Fixed by #2035

Comments

@ethaniel86
Copy link

As per title, i can't seems to configure this.
My goal is to create an public album allow anyone/anonymous to upload photos but disallow delete permission.

@ildyria
Copy link
Member

ildyria commented Dec 20, 2023

  1. Access Rights management is not available yet (but soonTM)
  2. It will be:

    My goal is to create an public album allow anyone/anonymous logged-in users to upload photos but disallow delete permission.

Allowing anyone/anonymous to upload is too much of a security risk, we are not allowing that directly from the UI.
However if you want to shoot yourself in the foot, it is be possible by changing one flag in the database:
https://github.com/LycheeOrg/Lychee/blob/master/app/Policies/AlbumPolicy.php#L161

	public function canUpload(User $user, ?AbstractAlbum $abstractAlbum = null): bool
	{
		// The upload right on the root album is directly determined by the user's capabilities.
		if ($abstractAlbum === null || !$abstractAlbum instanceof BaseAlbum) {
			return $user->may_upload;
		}

		return $this->isOwner($user, $abstractAlbum) ||
			$abstractAlbum->current_user_permissions()?->grants_upload === true ||
			$abstractAlbum->public_permissions()?->grants_upload === true;
	}

You just need to find the line in the access_permissions table with the user_id = null and album = <albumID> and set grants_upload to 1.
^ that part you can probably already do.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants