Remove admin account
This commit is contained in:
1 parent
4f28a59c7e
commit
db316b2914
13 files changed
+372
-144
No files matched your search
@@ -1,51 +0,0 @@
|
||||
class Netig
|
||||
hash_branch "admin" do |r|
|
||||
require_admin!(r)
|
||||
|
||||
@page_title = "Admin — NETig"
|
||||
@page_description = "Interface d'administration de NETig."
|
||||
@canonical_url = "https://netig.net/admin"
|
||||
|
||||
r.is do
|
||||
r.get do
|
||||
view "admin"
|
||||
end
|
||||
end
|
||||
|
||||
r.on "members" do
|
||||
r.is do
|
||||
r.get do
|
||||
@page_title = "Adhérents — Admin — NETig"
|
||||
|
||||
@members = DB[:members]
|
||||
.join(:accounts, id: :account_id)
|
||||
.select_all(:members)
|
||||
.select_append(Sequel[:accounts][:email].as(:email))
|
||||
.order(Sequel[:members][:id])
|
||||
.all
|
||||
|
||||
view "admin/members"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
private
|
||||
|
||||
def require_admin!(r)
|
||||
rodauth.require_account
|
||||
|
||||
admin = DB[:members].where(
|
||||
account_id: rodauth.account_id,
|
||||
admin: true
|
||||
).get(:admin)
|
||||
|
||||
return if admin
|
||||
|
||||
r.halt [
|
||||
403,
|
||||
{ "Content-Type" => "text/plain; charset=utf-8" },
|
||||
["Accès interdit."]
|
||||
]
|
||||
end
|
||||
end
|
||||
@@ -0,0 +1,34 @@
|
||||
|
||||
class Netig
|
||||
hash_branch "noyau" do |r|
|
||||
require_core_member!(r)
|
||||
|
||||
@page_title = "Noyau — NETig"
|
||||
@page_description = "Espace de gestion de l'association NETig."
|
||||
@canonical_url = "https://netig.net/noyau"
|
||||
|
||||
r.is do
|
||||
r.get do
|
||||
view "noyau"
|
||||
end
|
||||
end
|
||||
|
||||
r.on "members" do
|
||||
r.is do
|
||||
r.get do
|
||||
@page_title = "Adhérents — Noyau — NETig"
|
||||
|
||||
@members = DB[:members]
|
||||
.join(:accounts, id: :account_id)
|
||||
.select_all(:members)
|
||||
.select_append(Sequel[:accounts][:email].as(:email))
|
||||
.order(Sequel[:members][:id])
|
||||
.all
|
||||
|
||||
view "noyau/members"
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
Reference in new issue
Block a user