parent
0d697bc15a
commit
c0e4b1b3e2
|
@ -976,7 +976,7 @@
|
||||||
:emoji_manage_emoji
|
:emoji_manage_emoji
|
||||||
],
|
],
|
||||||
description:
|
description:
|
||||||
"What extra priviledges to allow admins (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
|
"What extra privileges to allow admins (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :moderator_privileges,
|
key: :moderator_privileges,
|
||||||
|
@ -994,7 +994,7 @@
|
||||||
:emoji_manage_emoji
|
:emoji_manage_emoji
|
||||||
],
|
],
|
||||||
description:
|
description:
|
||||||
"What extra priviledges to allow moderators (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
|
"What extra privileges to allow moderators (e.g. updating user credentials, get password reset token, delete users, index and read private statuses and chats)"
|
||||||
},
|
},
|
||||||
%{
|
%{
|
||||||
key: :birthday_required,
|
key: :birthday_required,
|
||||||
|
|
|
@ -5,7 +5,7 @@
|
||||||
In this guide we cover how you can migrate from a from source installation to one using OTP releases.
|
In this guide we cover how you can migrate from a from source installation to one using OTP releases.
|
||||||
|
|
||||||
## Pre-requisites
|
## Pre-requisites
|
||||||
You will be running commands as root. If you aren't root already, please elevate your priviledges by executing `sudo su`/`su`.
|
You will be running commands as root. If you aren't root already, please elevate your privileges by executing `sudo su`/`su`.
|
||||||
|
|
||||||
The system needs to have `curl` and `unzip` installed for downloading and unpacking release builds.
|
The system needs to have `curl` and `unzip` installed for downloading and unpacking release builds.
|
||||||
|
|
||||||
|
|
|
@ -8,7 +8,7 @@ This guide covers a installation using an OTP release. To install Pleroma from s
|
||||||
* A machine running Linux with GNU (e.g. Debian, Ubuntu) or musl (e.g. Alpine) libc and `x86_64`, `aarch64` or `armv7l` CPU, you have root access to. If you are not sure if it's compatible see [Detecting flavour section](#detecting-flavour) below
|
* A machine running Linux with GNU (e.g. Debian, Ubuntu) or musl (e.g. Alpine) libc and `x86_64`, `aarch64` or `armv7l` CPU, you have root access to. If you are not sure if it's compatible see [Detecting flavour section](#detecting-flavour) below
|
||||||
* A (sub)domain pointed to the machine
|
* A (sub)domain pointed to the machine
|
||||||
|
|
||||||
You will be running commands as root. If you aren't root already, please elevate your priviledges by executing `sudo su`/`su`.
|
You will be running commands as root. If you aren't root already, please elevate your privileges by executing `sudo su`/`su`.
|
||||||
|
|
||||||
While in theory OTP releases are possbile to install on any compatible machine, for the sake of simplicity this guide focuses only on Debian/Ubuntu and Alpine.
|
While in theory OTP releases are possbile to install on any compatible machine, for the sake of simplicity this guide focuses only on Debian/Ubuntu and Alpine.
|
||||||
|
|
||||||
|
|
|
@ -24,10 +24,10 @@ def call(%{assigns: %{user: %User{is_admin: false, is_moderator: false}}} = conn
|
||||||
|
|
||||||
def call(
|
def call(
|
||||||
%{assigns: %{user: %User{is_admin: is_admin, is_moderator: is_moderator}}} = conn,
|
%{assigns: %{user: %User{is_admin: is_admin, is_moderator: is_moderator}}} = conn,
|
||||||
priviledge
|
privilege
|
||||||
) do
|
) do
|
||||||
if (is_admin and priviledge in Config.get([:instance, :admin_privileges])) or
|
if (is_admin and privilege in Config.get([:instance, :admin_privileges])) or
|
||||||
(is_moderator and priviledge in Config.get([:instance, :moderator_privileges])) do
|
(is_moderator and privilege in Config.get([:instance, :moderator_privileges])) do
|
||||||
conn
|
conn
|
||||||
else
|
else
|
||||||
conn
|
conn
|
||||||
|
|
|
@ -64,7 +64,7 @@ test "denies a moderator that isn't privileged" do
|
||||||
assert conn.status == 403
|
assert conn.status == 403
|
||||||
end
|
end
|
||||||
|
|
||||||
test "accepts for a priviledged role even if other role isn't priviledged" do
|
test "accepts for a privileged role even if other role isn't privileged" do
|
||||||
clear_config([:instance, :admin_privileges], [:cofe])
|
clear_config([:instance, :admin_privileges], [:cofe])
|
||||||
clear_config([:instance, :moderator_privileges], [])
|
clear_config([:instance, :moderator_privileges], [])
|
||||||
user = insert(:user, is_admin: true, is_moderator: true)
|
user = insert(:user, is_admin: true, is_moderator: true)
|
||||||
|
@ -72,7 +72,7 @@ test "accepts for a priviledged role even if other role isn't priviledged" do
|
||||||
|
|
||||||
ret_conn = EnsurePrivilegedPlug.call(conn, :cofe)
|
ret_conn = EnsurePrivilegedPlug.call(conn, :cofe)
|
||||||
|
|
||||||
# priviledged through admin role
|
# privileged through admin role
|
||||||
assert conn == ret_conn
|
assert conn == ret_conn
|
||||||
|
|
||||||
clear_config([:instance, :admin_privileges], [])
|
clear_config([:instance, :admin_privileges], [])
|
||||||
|
@ -82,7 +82,7 @@ test "accepts for a priviledged role even if other role isn't priviledged" do
|
||||||
|
|
||||||
ret_conn = EnsurePrivilegedPlug.call(conn, :cofe)
|
ret_conn = EnsurePrivilegedPlug.call(conn, :cofe)
|
||||||
|
|
||||||
# priviledged through moderator role
|
# privileged through moderator role
|
||||||
assert conn == ret_conn
|
assert conn == ret_conn
|
||||||
end
|
end
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue