Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixes #18626: Popup error on group page with a readonly user in 6.2 #3399

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,10 @@ object NodeApi extends ApiModuleProvider[NodeApi] {
val description = "Accept or refuse pending nodes"
val (action, path) = POST / "nodes" / "pending"
}

// WARNING: read_only user can access this endpoint
// No modifications are performed here
// POST over GET is required here because we can provide too many information to be passed as URL parameters
final case object NodeDetailsTable extends NodeApi with InternalApi with ZeroParam with StartsAtVersion13 with SortIndex { val z = implicitly[Line].value
val description = "Getting data to build a Node table"
val (action, path) = POST / "nodes" / "details"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,14 @@ final case object OnlyAdmin extends AuthorizationApiMapping {
case Directive.Edit => DirectiveApi.UpdateDirective.x :: Nil

case Group.Read => GroupApi.ListGroups.x :: GroupApi.GroupDetails.x :: GroupApi.GetGroupTree.x ::
GroupApi.GetGroupCategoryDetails.x :: GroupApi.GroupInheritedProperties.x :: Nil
GroupApi.GetGroupCategoryDetails.x :: GroupApi.GroupInheritedProperties.x ::
NodeApi.NodeDetailsTable.x :: Nil
case Group.Write => GroupApi.CreateGroup.x :: GroupApi.DeleteGroup.x :: GroupApi.ReloadGroup.x ::
GroupApi.DeleteGroupCategory.x :: GroupApi.CreateGroupCategory.x :: Nil
case Group.Edit => GroupApi.UpdateGroup.x :: GroupApi.UpdateGroupCategory.x :: Nil

case Node.Read => NodeApi.ListAcceptedNodes.x :: NodeApi.ListPendingNodes.x :: NodeApi.NodeDetails.x ::
NodeApi.NodeInheritedProperties.x ::
NodeApi.NodeInheritedProperties.x :: NodeApi.NodeDetailsTable.x ::
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put it also in "Group.Read" so it's ok if you can read Group, but not Node!

// node read also allows to read some settings
AuthzForApi.withValues(SettingsApi.GetSetting, AclPathSegment.Segment("global_policy_mode") :: Nil ) ::
AuthzForApi.withValues(SettingsApi.GetSetting, AclPathSegment.Segment("global_policy_mode_overridable") :: Nil ) ::
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -416,6 +416,9 @@ class NodeApi (
}
}

// WARNING : This is a READ ONLY action
// No modifications will be performed
// read_only user can access this endpoint
object NodeDetailsTable extends LiftApiModule0 {
val schema = API.NodeDetailsTable
val restExtractor = restExtractorService
Expand Down