Skip to content

Commit

Permalink
fix(graph): Fix tests after Uploader Role changes
Browse files Browse the repository at this point in the history
  • Loading branch information
rhafer committed May 21, 2024
1 parent f931da5 commit 72a6ea3
Show file tree
Hide file tree
Showing 3 changed files with 26 additions and 25 deletions.
18 changes: 9 additions & 9 deletions services/graph/pkg/unifiedrole/unifiedrole.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ const (
UnifiedRoleSpaceEditorID = "58c63c02-1d89-4572-916a-870abc5a1b7d"
// UnifiedRoleFileEditorID Unified role file editor id.
UnifiedRoleFileEditorID = "2d00ce52-1fc2-4dbc-8b95-a73b73395f5a"
// UnifiedRoleUploaderID Unified role uploader id.
UnifiedRoleUploaderID = "1c996275-f1c9-4e71-abdf-a42f6495e960"
// UnifiedRoleEditorLiteID Unified role editor-lite id.
UnifiedRoleEditorLiteID = "1c996275-f1c9-4e71-abdf-a42f6495e960"
// UnifiedRoleManagerID Unified role manager id.
UnifiedRoleManagerID = "312c0871-5ef7-4b3a-85b6-0e4074c64049"
// UnifiedRoleSecureViewerID Unified role secure viewer id.
Expand Down Expand Up @@ -66,7 +66,7 @@ var legacyNames map[string]string = map[string]string{
UnifiedRoleSpaceEditorID: "editor",
UnifiedRoleEditorID: conversions.RoleEditor,
UnifiedRoleFileEditorID: conversions.RoleFileEditor,
UnifiedRoleUploaderID: conversions.RoleUploader,
UnifiedRoleEditorLiteID: conversions.RoleEditorLite,
UnifiedRoleManagerID: conversions.RoleManager,
UnifiedRoleSecureViewerID: conversions.RoleSecureViewer,
}
Expand Down Expand Up @@ -160,11 +160,11 @@ func NewFileEditorUnifiedRole() *libregraph.UnifiedRoleDefinition {
}
}

// NewUploaderUnifiedRole creates an uploader role
func NewUploaderUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := conversions.NewUploaderRole()
// NewEditorLiteUnifiedRole creates an editor-lite role
func NewEditorLiteUnifiedRole() *libregraph.UnifiedRoleDefinition {
r := conversions.NewEditorLiteRole()
return &libregraph.UnifiedRoleDefinition{
Id: proto.String(UnifiedRoleUploaderID),
Id: proto.String(UnifiedRoleEditorLiteID),
Description: proto.String("View, download and upload."),
DisplayName: displayName(r),
RolePermissions: []libregraph.UnifiedRolePermission{
Expand Down Expand Up @@ -239,7 +239,7 @@ func GetBuiltinRoleDefinitionList() []*libregraph.UnifiedRoleDefinition {
NewEditorUnifiedRole(),
NewSpaceEditorUnifiedRole(),
NewFileEditorUnifiedRole(),
NewUploaderUnifiedRole(),
NewEditorLiteUnifiedRole(),
NewManagerUnifiedRole(),
NewSecureViewerUnifiedRole(),
}
Expand Down Expand Up @@ -501,7 +501,7 @@ func displayName(role *conversions.Role) *string {
displayName = canEdit
case conversions.RoleFileEditor:
displayName = canEdit
case conversions.RoleUploader:
case conversions.RoleEditorLite:
displayName = "Can upload"
case conversions.RoleManager:
displayName = "Can manage"
Expand Down
9 changes: 5 additions & 4 deletions services/graph/pkg/unifiedrole/unifiedrole_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -171,8 +171,8 @@ var _ = Describe("unifiedroles", func() {
unifiedrole.UnifiedRoleConditionFolder,
[]*libregraph.UnifiedRoleDefinition{
unifiedrole.NewSecureViewerUnifiedRole(),
unifiedrole.NewUploaderUnifiedRole(),
unifiedrole.NewViewerUnifiedRole(),
unifiedrole.NewEditorLiteUnifiedRole(),
unifiedrole.NewEditorUnifiedRole(),
},
),
Expand All @@ -194,8 +194,8 @@ var _ = Describe("unifiedroles", func() {
unifiedrole.UnifiedRoleConditionFolder,
[]*libregraph.UnifiedRoleDefinition{
unifiedrole.NewSecureViewerUnifiedRole(),
unifiedrole.NewUploaderUnifiedRole(),
unifiedrole.NewViewerUnifiedRole(),
unifiedrole.NewEditorLiteUnifiedRole(),
unifiedrole.NewEditorUnifiedRole(),
},
),
Expand All @@ -221,10 +221,11 @@ var _ = Describe("unifiedroles", func() {

Entry(
"mixed",
append(rolesToAction(unifiedrole.NewUploaderUnifiedRole()), unifiedrole.DriveItemQuotaRead),
append(rolesToAction(unifiedrole.NewEditorLiteUnifiedRole()), unifiedrole.DriveItemQuotaRead),
unifiedrole.UnifiedRoleConditionFolder,
[]*libregraph.UnifiedRoleDefinition{
unifiedrole.NewUploaderUnifiedRole(),
unifiedrole.NewSecureViewerUnifiedRole(),
unifiedrole.NewEditorLiteUnifiedRole(),
},
),
)
Expand Down
24 changes: 12 additions & 12 deletions tests/acceptance/features/apiSharingNg/listPermissions.feature
Original file line number Diff line number Diff line change
Expand Up @@ -106,19 +106,19 @@ Feature: List a sharing permissions
"description": {
"type": "string",
"enum": [
"View, download and upload."
"View and download."
]
},
"displayName": {
"type": "string",
"enum": [
"Can upload"
"Can view"
]
},
"id": {
"type": "string",
"enum": [
"1c996275-f1c9-4e71-abdf-a42f6495e960"
"b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
]
}
}
Expand All @@ -141,19 +141,19 @@ Feature: List a sharing permissions
"description": {
"type": "string",
"enum": [
"View and download."
"View, download and upload."
]
},
"displayName": {
"type": "string",
"enum": [
"Can view"
"Can upload"
]
},
"id": {
"type": "string",
"enum": [
"b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
"1c996275-f1c9-4e71-abdf-a42f6495e960"
]
}
}
Expand Down Expand Up @@ -855,13 +855,13 @@ Feature: List a sharing permissions
"const": 2
},
"description": {
"const": "View, download and upload."
"const": "View and download."
},
"displayName": {
"const": "Can upload"
"const": "Can view"
},
"id": {
"const": "1c996275-f1c9-4e71-abdf-a42f6495e960"
"const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
}
}
},
Expand All @@ -878,13 +878,13 @@ Feature: List a sharing permissions
"const": 3
},
"description": {
"const": "View and download."
"const": "View, download and upload."
},
"displayName": {
"const": "Can view"
"const": "Can upload"
},
"id": {
"const": "b1e2218d-eef8-4d4c-b82d-0f1a1b48f3b5"
"const": "1c996275-f1c9-4e71-abdf-a42f6495e960"
}
}
},
Expand Down

0 comments on commit 72a6ea3

Please sign in to comment.