File tree 3 files changed +7
-14
lines changed
server/src-lib/Hasura/GraphQL
3 files changed +7
-14
lines changed Original file line number Diff line number Diff line change @@ -35,7 +35,7 @@ buildGQLContext allTables =
35
35
buildContextForRole roleName
36
36
where
37
37
allRoles :: HashSet RoleName
38
- allRoles = allTables ^.. folded. tiRolePermInfoMap. to M. keys. folded
38
+ allRoles = S. insert adminRole $ allTables ^.. folded. tiRolePermInfoMap. to M. keys. folded
39
39
40
40
buildContextForRole roleName = do
41
41
SQLGenCtx { stringifyNum } <- askSQLGenCtx
Original file line number Diff line number Diff line change @@ -392,16 +392,7 @@ fieldSelection
392
392
fieldSelection fieldInfo selectPermissions stringifyNum = do
393
393
case fieldInfo of
394
394
FIColumn columnInfo -> maybeToList <$> runMaybeT do
395
- -- TODO FIXME TODO FIXME
396
- -- TODO FIXME TODO FIXME
397
- -- TODO FIXME TODO FIXME
398
- -- TODO FIXME TODO FIXME
399
- -- TODO FIXME TODO FIXME
400
-
401
- -- This guard should be enabled, but disabling it allows us to run some
402
- -- queries until we fix permissions.
403
-
404
- -- guard $ Set.member (pgiColumn columnInfo) (spiCols selectPermissions)
395
+ guard $ Set. member (pgiColumn columnInfo) (spiCols selectPermissions)
405
396
let fieldName = pgiName columnInfo
406
397
pathArg = jsonPathArg $ pgiType columnInfo
407
398
field <- lift $ P. column (pgiType columnInfo) (G. Nullability $ pgiIsNullable columnInfo)
Original file line number Diff line number Diff line change @@ -26,7 +26,7 @@ import Hasura.GraphQL.Parser.Class
26
26
import Hasura.GraphQL.Parser.Column (qualifiedObjectToName )
27
27
import Hasura.RQL.Types
28
28
import Hasura.SQL.Types
29
-
29
+ import Hasura.RQL.DML.Internal
30
30
31
31
-- | Table select columns enum
32
32
--
@@ -93,8 +93,10 @@ tablePermissions
93
93
-> m (Maybe RolePermInfo )
94
94
tablePermissions table = do
95
95
roleName <- askRoleName
96
- tableInfo <- _tiRolePermInfoMap <$> askTableInfo table
97
- pure $ Map. lookup roleName tableInfo
96
+ tableInfo <- askTableInfo table
97
+ pure $ if roleName == adminRole
98
+ then Just $ mkAdminRolePermInfo $ _tiCoreInfo tableInfo
99
+ else Map. lookup roleName $ _tiRolePermInfoMap tableInfo
98
100
99
101
tableSelectPermissions
100
102
:: forall m n . (MonadSchema n m )
You can’t perform that action at this time.
0 commit comments