Some users can be administrators now.
This commit is contained in:
parent
35428314b5
commit
781a25debe
@ -71,7 +71,7 @@ class DNSManager::Storage
|
||||
# Does the zone already exist?
|
||||
if z = zones_by_domain.get? zone.domain
|
||||
# User must own the zone.
|
||||
unless user_data.domains.includes? zone.domain
|
||||
unless user_data.domains.includes?(zone.domain) || user_data.admin
|
||||
Baguette::Log.warning "user #{user_id} doesn't own domain #{zone.domain}"
|
||||
return Response::NoOwnership.new
|
||||
end
|
||||
@ -107,7 +107,7 @@ class DNSManager::Storage
|
||||
end
|
||||
|
||||
# User must own the zone.
|
||||
unless user_data.domains.includes? domain
|
||||
unless user_data.domains.includes?(domain) || user_data.admin
|
||||
Baguette::Log.warning "user #{user_id} doesn't own domain #{domain}"
|
||||
return Response::NoOwnership.new
|
||||
end
|
||||
@ -146,7 +146,7 @@ class DNSManager::Storage
|
||||
end
|
||||
|
||||
# User must own the zone.
|
||||
unless user_data.domains.includes? domain
|
||||
unless user_data.domains.includes?(domain) || user_data.admin
|
||||
Baguette::Log.warning "user #{user_id} doesn't own domain #{domain}"
|
||||
return Response::NoOwnership.new
|
||||
end
|
||||
@ -185,7 +185,7 @@ class DNSManager::Storage
|
||||
end
|
||||
|
||||
# User must own the zone.
|
||||
unless user_data.domains.includes? domain
|
||||
unless user_data.domains.includes?(domain) || user_data.admin
|
||||
Baguette::Log.warning "user #{user_id} doesn't own domain #{domain}"
|
||||
return Response::NoOwnership.new
|
||||
end
|
||||
@ -210,7 +210,7 @@ class DNSManager::Storage
|
||||
end
|
||||
|
||||
# User must own the domain.
|
||||
unless user_data.domains.includes? domain
|
||||
unless user_data.domains.includes?(domain) || user_data.admin
|
||||
Baguette::Log.warning "user #{user_id} tries to delete domain #{domain} but doesn't own it"
|
||||
return Response::NoOwnership.new
|
||||
end
|
||||
@ -239,7 +239,7 @@ class DNSManager::Storage
|
||||
end
|
||||
|
||||
# User must own the domain.
|
||||
unless user_data.domains.includes? domain
|
||||
unless user_data.domains.includes?(domain) || user_data.admin
|
||||
Baguette::Log.warning "user #{user_id} tries to get zone #{domain} but doesn't own it"
|
||||
return Response::NoOwnership.new
|
||||
end
|
||||
|
@ -5,11 +5,13 @@ require "uuid/json"
|
||||
class DNSManager::Storage::UserData
|
||||
include JSON::Serializable
|
||||
|
||||
property uid : Int32
|
||||
property uid : Int32
|
||||
|
||||
# Users may have many domains, and a domain can have many owners.
|
||||
property domains = [] of String
|
||||
|
||||
property admin : Bool = false
|
||||
|
||||
def initialize(@uid)
|
||||
end
|
||||
end
|
||||
|
Loading…
Reference in New Issue
Block a user