graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellNone
LanguageHaskell2010

Hasura.RQL.DDL.Schema.Cache.Permission

Synopsis

Documentation

mkBooleanPermissionMap :: (RoleName -> a) -> HashMap RoleName a -> OrderedRoles -> HashMap RoleName a Source #

newtype OrderedRoles Source #

OrderedRoles is a data type to hold topologically sorted roles according to each role's parent roles, see orderRoles for more details.

Constructors

OrderedRoles 

Fields

Instances

Instances details
Eq OrderedRoles Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache.Permission

Generic OrderedRoles Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache.Permission

Associated Types

type Rep OrderedRoles :: Type -> Type #

Cacheable OrderedRoles Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache.Permission

type Rep OrderedRoles Source # 
Instance details

Defined in Hasura.RQL.DDL.Schema.Cache.Permission

type Rep OrderedRoles = D1 ('MetaData "OrderedRoles" "Hasura.RQL.DDL.Schema.Cache.Permission" "graphql-engine-1.0.0-inplace" 'True) (C1 ('MetaCons "OrderedRoles" 'PrefixI 'True) (S1 ('MetaSel ('Just "_unOrderedRoles") 'NoSourceUnpackedness 'NoSourceStrictness 'DecidedLazy) (Rec0 [Role])))

orderRoles :: MonadError QErr m => [Role] -> m OrderedRoles Source #

orderRoles is used to order the roles, in such a way that given a role R with n parent roles - PR1, PR2 .. PRn, then the orderRoles function will order the roles in such a way that all the parent roles precede the role R. Note that the order of the parent roles itself doesn't matter as long as they precede the roles on which they are dependent on.

For example, the orderRoles may return `[PR1, PR3, PR2, ... PRn, R]` or `[PR5, PR3, PR1 ... R]`, both of them are correct because all the parent roles precede the inherited role R, assuming the parent roles themselves don't have any parents for the sake of this example.

resolveCheckPermission :: forall m p. MonadWriter (Seq CollectedInfo) m => CheckPermission p -> RoleName -> InconsistentRoleEntity -> m (Maybe p) Source #

resolveCheckPermission is a helper function which will convert the indermediate type CheckPermission to its original type. It will record any metadata inconsistencies, if exists.

withPermission :: forall bknd a b c s arr. (ArrowChoice arr, ArrowWriter (Seq CollectedInfo) arr, BackendMetadata bknd) => WriterA (Seq SchemaDependency) (ErrorA QErr arr) (a, s) b -> (a, ((SourceName, TableName bknd, PermDef bknd c, Proxy bknd), s)) `arr` Maybe b Source #