Skip to content

Commit c4c6334

Browse files
author
Auke Booij
committed
[skip ci] re-enable permission check guard
1 parent f9f4924 commit c4c6334

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

server/src-lib/Hasura/GraphQL/Schema.hs

+1-1
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ buildGQLContext allTables =
3535
buildContextForRole roleName
3636
where
3737
allRoles :: HashSet RoleName
38-
allRoles = allTables ^.. folded.tiRolePermInfoMap.to M.keys.folded
38+
allRoles = S.insert adminRole $ allTables ^.. folded.tiRolePermInfoMap.to M.keys.folded
3939

4040
buildContextForRole roleName = do
4141
SQLGenCtx{ stringifyNum } <- askSQLGenCtx

server/src-lib/Hasura/GraphQL/Schema/Select.hs

+1-10
Original file line numberDiff line numberDiff line change
@@ -392,16 +392,7 @@ fieldSelection
392392
fieldSelection fieldInfo selectPermissions stringifyNum = do
393393
case fieldInfo of
394394
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)
405396
let fieldName = pgiName columnInfo
406397
pathArg = jsonPathArg $ pgiType columnInfo
407398
field <- lift $ P.column (pgiType columnInfo) (G.Nullability $ pgiIsNullable columnInfo)

server/src-lib/Hasura/GraphQL/Schema/Table.hs

+5-3
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ import Hasura.GraphQL.Parser.Class
2626
import Hasura.GraphQL.Parser.Column (qualifiedObjectToName)
2727
import Hasura.RQL.Types
2828
import Hasura.SQL.Types
29-
29+
import Hasura.RQL.DML.Internal
3030

3131
-- | Table select columns enum
3232
--
@@ -93,8 +93,10 @@ tablePermissions
9393
-> m (Maybe RolePermInfo)
9494
tablePermissions table = do
9595
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
98100

99101
tableSelectPermissions
100102
:: forall m n. (MonadSchema n m)

0 commit comments

Comments
 (0)