Safe Haskell | Safe-Inferred |
---|---|
Language | Haskell2010 |
Synopsis
- mkBooleanPermissionMap :: (RoleName -> a) -> HashMap RoleName a -> OrderedRoles -> HashMap RoleName a
- data OrderedRoles
- orderRoles :: MonadError QErr m => [Role] -> m OrderedRoles
- resolveCheckPermission :: MonadWriter (Seq CollectItem) m => CheckPermission p -> RoleName -> InconsistentRoleEntity -> m (Maybe p)
- buildTablePermissions :: forall b m r. (MonadError QErr m, MonadWriter (Seq CollectItem) m, BackendMetadata b, GetAggregationPredicatesDeps b, MonadReader r m, Has (ScalarTypeParsingContext b) r) => Environment -> SourceName -> TableCoreCache b -> FieldInfoMap (FieldInfo b) -> TablePermissionInputs b -> OrderedRoles -> m (RolePermInfoMap b)
- 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)
Documentation
mkBooleanPermissionMap :: (RoleName -> a) -> HashMap RoleName a -> OrderedRoles -> HashMap RoleName a Source #
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
Generic OrderedRoles Source # | |
Defined in Hasura.RQL.DDL.Schema.Cache.Permission type Rep OrderedRoles :: Type -> Type # from :: OrderedRoles -> Rep OrderedRoles x # to :: Rep OrderedRoles x -> OrderedRoles # | |
Eq OrderedRoles Source # | |
Defined in Hasura.RQL.DDL.Schema.Cache.Permission (==) :: OrderedRoles -> OrderedRoles -> Bool # (/=) :: OrderedRoles -> OrderedRoles -> Bool # | |
type Rep OrderedRoles Source # | |
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.
buildTablePermissions :: forall b m r. (MonadError QErr m, MonadWriter (Seq CollectItem) m, BackendMetadata b, GetAggregationPredicatesDeps b, MonadReader r m, Has (ScalarTypeParsingContext b) r) => Environment -> SourceName -> TableCoreCache b -> FieldInfoMap (FieldInfo b) -> TablePermissionInputs b -> OrderedRoles -> m (RolePermInfoMap b) Source #
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
.