dnsmanagerd always tell whether the client is admin.

This commit is contained in:
Philippe Pittoli 2024-03-31 11:52:46 +02:00
parent e6d6a2bb20
commit 7d94cf587d
2 changed files with 5 additions and 5 deletions

View File

@ -50,7 +50,7 @@ import Prelude (Unit, bind, discard, unit, ($), (=<<), (<>), show, pure)
import Bulma as Bulma import Bulma as Bulma
import Data.Array as A import Data.Array as A
import Data.Maybe (Maybe(..), maybe, fromMaybe) import Data.Maybe (Maybe(..), maybe)
import Data.Either (Either(..)) import Data.Either (Either(..))
import Data.Tuple (Tuple(..)) import Data.Tuple (Tuple(..))
import Halogen as H import Halogen as H
@ -717,9 +717,9 @@ handleAction = case _ of
m@(DNSManager.MkAcceptedDomains _) -> do m@(DNSManager.MkAcceptedDomains _) -> do
handleAction $ Log $ SuccessLog $ "Received the list of accepted domains!" handleAction $ Log $ SuccessLog $ "Received the list of accepted domains!"
handleAction $ DispatchDNSMessage m handleAction $ DispatchDNSMessage m
m@(DNSManager.MkLogged message) -> do m@(DNSManager.MkLogged logged_message) -> do
handleAction $ Log $ SuccessLog $ "Authenticated to dnsmanagerd!" handleAction $ Log $ SuccessLog $ "Authenticated to dnsmanagerd!"
H.tell _nav unit $ NavigationInterface.ToggleAdmin (fromMaybe false message.admin) H.tell _nav unit $ NavigationInterface.ToggleAdmin logged_message.admin
handleAction $ DispatchDNSMessage m handleAction $ DispatchDNSMessage m
m@(DNSManager.MkDomainAdded response) -> do m@(DNSManager.MkDomainAdded response) -> do
handleAction $ Log $ SuccessLog $ "Domain added: " <> response.domain handleAction $ Log $ SuccessLog $ "Domain added: " <> response.domain

View File

@ -208,11 +208,11 @@ codecAcceptedDomains ∷ CA.JsonCodec AcceptedDomains
codecAcceptedDomains = CA.object "AcceptedDomains" (CAR.record { domains: CA.array CA.string }) codecAcceptedDomains = CA.object "AcceptedDomains" (CAR.record { domains: CA.array CA.string })
{- 16 -} {- 16 -}
type Logged = { accepted_domains :: Array String, my_domains :: Array String, admin :: Maybe Boolean } type Logged = { accepted_domains :: Array String, my_domains :: Array String, admin :: Boolean }
codecLogged ∷ CA.JsonCodec Logged codecLogged ∷ CA.JsonCodec Logged
codecLogged = CA.object "Logged" (CAR.record { accepted_domains: CA.array CA.string codecLogged = CA.object "Logged" (CAR.record { accepted_domains: CA.array CA.string
, my_domains: CA.array CA.string , my_domains: CA.array CA.string
, admin: CAR.optional CA.boolean , admin: CA.boolean
}) })
{- 17 -} {- 17 -}