File tree Expand file tree Collapse file tree 1 file changed +16
-2
lines changed
src/Share/Web/Authorization Expand file tree Collapse file tree 1 file changed +16
-2
lines changed Original file line number Diff line number Diff line change @@ -353,19 +353,33 @@ deriving instance (Ord (f RoleRef), Ord subject) => Ord (RoleAssignment f subjec
353353
354354deriving instance (Show (f RoleRef ), Show subject ) => Show (RoleAssignment f subject )
355355
356- instance (ToJSON user , ToJSON (f RoleRef )) => ToJSON (RoleAssignment f user ) where
356+ instance (ToJSON user ) => ToJSON (RoleAssignment Identity user ) where
357+ toJSON RoleAssignment {.. } =
358+ object
359+ [ " subject" Aeson. .= subject,
360+ " role" Aeson. .= roles
361+ ]
362+
363+ instance (ToJSON user ) => ToJSON (RoleAssignment Set user ) where
357364 toJSON RoleAssignment {.. } =
358365 object
359366 [ " subject" Aeson. .= subject,
360367 " roles" Aeson. .= roles
361368 ]
362369
363- instance (FromJSON user , FromJSON (f RoleRef )) => FromJSON (RoleAssignment f user ) where
370+ instance (FromJSON user ) => FromJSON (RoleAssignment Identity user ) where
371+ parseJSON = Aeson. withObject " RoleAssignment" $ \ o -> do
372+ subject <- o Aeson. .: " subject"
373+ roles <- o Aeson. .: " role"
374+ pure RoleAssignment {.. }
375+
376+ instance (FromJSON user ) => FromJSON (RoleAssignment Set user ) where
364377 parseJSON = Aeson. withObject " RoleAssignment" $ \ o -> do
365378 subject <- o Aeson. .: " subject"
366379 roles <- o Aeson. .: " roles"
367380 pure RoleAssignment {.. }
368381
382+
369383-- | A type for mixing in permissions info on a response for a resource.
370384newtype PermissionsInfo = PermissionsInfo (Set RolePermission )
371385 deriving (Show )
You can’t perform that action at this time.
0 commit comments