Commit dbc484d2 authored by Nina's avatar Nina

Merge branch 'multiple-site-admins' into 'master'

Allow configurable and multiple superadmins.

See merge request schleuder/schleuder-web!65
parents 3708f870 843c35bb
Pipeline #32388 failed with stages
in 9 minutes and 3 seconds
......@@ -8,7 +8,7 @@ class Account < ActiveRecord::Base
end
def superadmin?
self.email == 'root@localhost'
Array(Conf.superadmins).include?(self.email)
end
def subscribed_to?(list)
......
......@@ -15,12 +15,17 @@ defaults: &defaults
port: <%= ENV["SCHLEUDER_API_PORT"] || 4443 %>
tls_fingerprint: <%= ENV["SCHLEUDER_TLS_FINGERPRINT"] %>
api_key: <%= ENV["SCHLEUDER_API_KEY"] %>
superadmins:
- root@localhost
test:
<<: *defaults
api:
tls_fingerprint: <%= ENV["SCHLEUDER_TLS_FINGERPRINT"] || "6062f05f89384e5f2cda7ab3fc4f5af971d1c524187d90d8e3304e5e0ca6f853" %>
api_key: <%= ENV["SCHLEUDER_API_KEY"] || "ii123456789ii" %>
superadmins:
- admin@localhost
- someoneelse@example.net
development:
<<: *defaults
web_hostname: localhost:3000
......
......@@ -33,8 +33,8 @@ describe Account do
end
describe "#superadmin?" do
it "returns true if email address is root@localhost" do
admin_account = create(:account, email: "root@localhost")
it "returns true if email address is included in Conf.superadmins" do
admin_account = create(:account, email: "admin@localhost")
expect(admin_account.superadmin?).to eq true
end
......
......@@ -25,5 +25,9 @@ describe Conf do
ENV["SCHLEUDER_API_PORT"] = nil
Conf.squire.reload!
end
it "allows multiple site admins" do
expect(Conf.superadmins).to eql(['admin@localhost', 'someoneelse@example.net'])
end
end
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment