Skip to content

Commit

Permalink
chore: Add queryData privilege constant and update privilege mappings
Browse files Browse the repository at this point in the history
  • Loading branch information
TanmoySG committed May 13, 2024
1 parent 340c73a commit 4b34f4d
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 1 deletion.
1 change: 1 addition & 0 deletions internal/privileges/constants.go
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ const (

AddData = "addData"
ReadData = "readData"
QueryData = "queryData"
UpdateData = "updateData"
DeleteData = "deleteData"
)
2 changes: 2 additions & 0 deletions internal/privileges/privileges.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ var PrivilegeScope = map[string]string{
ReadData: CollectionPrivileges,
UpdateData: CollectionPrivileges,
DeleteData: CollectionPrivileges,
QueryData: CollectionPrivileges,
}

var PrivilegeType = map[string]PrivilegeActionType{
Expand All @@ -39,6 +40,7 @@ var PrivilegeType = map[string]PrivilegeActionType{
ReadDatabase: ReadPrivilege,
ReadCollection: ReadPrivilege,
ReadData: ReadPrivilege,
QueryData: ReadPrivilege,

CreateDatabase: WritePrivilege,
UpdateDatabase: WritePrivilege,
Expand Down
2 changes: 1 addition & 1 deletion internal/server/handlers/data.go
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ func (wh wdbHandlers) ReadData(c *fiber.Ctx) error {
}

func (wh wdbHandlers) QueryData(c *fiber.Ctx) error {
privilege := privileges.ReadData
privilege := privileges.QueryData

var apiError *er.WdbError
var queriedData interface{}
Expand Down

0 comments on commit 4b34f4d

Please sign in to comment.