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