graphql-engine-1.0.0: GraphQL API over Postgres
Safe HaskellSafe-Inferred
LanguageHaskell2010

Hasura.RQL.DDL.Schema.Cache.Permission

Synopsis

Documentation

data OrderedRoles Source #

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

Instances

Instances details
Generic OrderedRoles Source # 
Instance details

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

Associated Types

type Rep OrderedRoles :: Type -> Type #

Eq 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 :: MonadWriter (Seq CollectItem) 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.

buildLogicalModelPermissions :: forall b m r. (MonadError QErr m, MonadWriter (Seq CollectItem) m, BackendMetadata b, GetAggregationPredicatesDeps b, MonadReader r m, Has (ScalarTypeParsingContext b) r) => SourceName -> TableCoreCache b -> LogicalModelName -> InsOrdHashMap (Column b) (LogicalModelField b) -> InsOrdHashMap RoleName (SelPermDef b) -> OrderedRoles -> m (RolePermInfoMap b) Source #

Create the permission map for a native query based on the select permissions given in metadata. Compare with buildTablePermissions.