Safe Haskell | None |
---|---|
Language | Haskell2010 |
Synopsis
- mkBooleanPermissionMap :: (RoleName -> a) -> HashMap RoleName a -> OrderedRoles -> HashMap RoleName a
- newtype OrderedRoles = OrderedRoles {
- _unOrderedRoles :: [Role]
- orderRoles :: MonadError QErr m => [Role] -> m OrderedRoles
- resolveCheckPermission :: forall m p. MonadWriter (Seq CollectedInfo) m => CheckPermission p -> RoleName -> InconsistentRoleEntity -> m (Maybe p)
- resolveCheckTablePermission :: forall b perm m. (MonadWriter (Seq CollectedInfo) m, BackendMetadata b) => CheckPermission perm -> Maybe (RolePermInfo b) -> (RolePermInfo b -> Maybe perm) -> RoleName -> SourceName -> TableName b -> PermType -> m (Maybe perm)
- buildTablePermissions :: forall b m arr. (ArrowChoice arr, ArrowDistribute arr, ArrowCache m arr, MonadError QErr m, ArrowWriter (Seq CollectedInfo) arr, BackendMetadata b, Cacheable (Proxy b), GetAggregationPredicatesDeps b) => (Proxy b, SourceName, Dependency (TableCoreCache b), FieldInfoMap (FieldInfo b), TablePermissionInputs b, OrderedRoles) `arr` RolePermInfoMap b
- mkPermissionMetadataObject :: forall b a. BackendMetadata b => SourceName -> TableName b -> PermDef b a -> MetadataObject
- mkRemoteSchemaPermissionMetadataObject :: AddRemoteSchemaPermission -> MetadataObject
- 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
- buildPermission :: forall b a arr m. (ArrowChoice arr, ArrowWriter (Seq CollectedInfo) arr, ArrowCache m arr, Cacheable (a b), Cacheable (Proxy b), MonadError QErr m, BackendMetadata b, GetAggregationPredicatesDeps b) => (Proxy b, Dependency (TableCoreCache b), SourceName, TableName b, FieldInfoMap (FieldInfo b), Maybe (PermDef b a)) `arr` Maybe (PermInfo a b)
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.
Instances
Eq OrderedRoles Source # | |
Defined in Hasura.RQL.DDL.Schema.Cache.Permission (==) :: OrderedRoles -> OrderedRoles -> Bool # (/=) :: OrderedRoles -> OrderedRoles -> Bool # | |
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 # | |
Cacheable OrderedRoles Source # | |
Defined in Hasura.RQL.DDL.Schema.Cache.Permission unchanged :: Accesses -> OrderedRoles -> OrderedRoles -> Bool Source # | |
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 :: 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.
resolveCheckTablePermission :: forall b perm m. (MonadWriter (Seq CollectedInfo) m, BackendMetadata b) => CheckPermission perm -> Maybe (RolePermInfo b) -> (RolePermInfo b -> Maybe perm) -> RoleName -> SourceName -> TableName b -> PermType -> m (Maybe perm) Source #
buildTablePermissions :: forall b m arr. (ArrowChoice arr, ArrowDistribute arr, ArrowCache m arr, MonadError QErr m, ArrowWriter (Seq CollectedInfo) arr, BackendMetadata b, Cacheable (Proxy b), GetAggregationPredicatesDeps b) => (Proxy b, SourceName, Dependency (TableCoreCache b), FieldInfoMap (FieldInfo b), TablePermissionInputs b, OrderedRoles) `arr` RolePermInfoMap b Source #
mkPermissionMetadataObject :: forall b a. BackendMetadata b => SourceName -> TableName b -> PermDef b a -> MetadataObject Source #
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 #
buildPermission :: forall b a arr m. (ArrowChoice arr, ArrowWriter (Seq CollectedInfo) arr, ArrowCache m arr, Cacheable (a b), Cacheable (Proxy b), MonadError QErr m, BackendMetadata b, GetAggregationPredicatesDeps b) => (Proxy b, Dependency (TableCoreCache b), SourceName, TableName b, FieldInfoMap (FieldInfo b), Maybe (PermDef b a)) `arr` Maybe (PermInfo a b) Source #