Permission: split permission "player" from "control"

Some users want certain clients to fully control playback, but do not
want them to be able to trigger database update.

Closes https://github.com/MusicPlayerDaemon/MPD/issues/1124
This commit is contained in:
Max Kellermann
2021-10-14 14:16:34 +02:00
parent 8ad17d25ef
commit 9a766f4cd9
5 changed files with 41 additions and 30 deletions

View File

@@ -41,6 +41,7 @@ static constexpr struct {
} permission_names[] = {
{ "read", PERMISSION_READ },
{ "add", PERMISSION_ADD },
{ "player", PERMISSION_PLAYER },
{ "control", PERMISSION_CONTROL },
{ "admin", PERMISSION_ADMIN },
{ nullptr, 0 },
@@ -75,6 +76,11 @@ static unsigned parsePermissions(const char *string)
if (!i.empty())
permission |= ParsePermission(i);
/* for backwards compatiblity with MPD 0.22 and older,
"control" implies "play" */
if (permission & PERMISSION_CONTROL)
permission |= PERMISSION_PLAYER;
return permission;
}