pnp / pnp/powershell

[BUG] Export-PnPListToSiteTemplate doesn't export token for default RoleDefinitions

Open
#3,967 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

bug
Dominant language
C#
Stars
904
Forks
407
Avg merge
9h 16m
Merged PRs (30d)
10

Description

Reporting an Issue or Missing Feature

When I export a list with custom permissions no token for default RoleDefinition is set for the RoleDefinition attribute

          <pnp:Security>
            <pnp:BreakRoleInheritance CopyRoleAssignments="false" ClearSubscopes="false">
              <pnp:RoleAssignment Principal="{associatedownergroupid}" RoleDefinition="Lezen" />
            </pnp:BreakRoleInheritance>
          </pnp:Security>
Expected behavior

When I export the list I want to get the token for default RoleDefinition. See below

          <pnp:Security>
            <pnp:BreakRoleInheritance CopyRoleAssignments="false" ClearSubscopes="false">
              <pnp:RoleAssignment Principal="{associatedownergroupid}" RoleDefinition="{roledefinition:Reader}" />
            </pnp:BreakRoleInheritance>
          </pnp:Security>
Actual behavior

When I export a list with custom permissions no token for default RoleDefinition is set for the RoleDefinition attribute

          <pnp:Security>
            <pnp:BreakRoleInheritance CopyRoleAssignments="false" ClearSubscopes="false">
              <pnp:RoleAssignment Principal="{associatedownergroupid}" RoleDefinition="Lezen" />
            </pnp:BreakRoleInheritance>
          </pnp:Security>
Steps to reproduce behavior

Run the Export-PnPListToSiteTemplate cmdlet on a list with custom permissions with built in RoleDefinition

What is the version of the Cmdlet module you are running?

2.4.0

Which operating system/environment are you running PnP PowerShell on?
  • Windows
  • Linux
  • MacOS
  • Azure Cloud Shell
  • Azure Functions
  • Other : please specify

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start at the implementation of the Export-PnPListToSiteTemplate cmdlet and trace how custom list permissions serialize RoleDefinition values. Reproduce the issue with a list using a built-in RoleDefinition, then verify that the exported template uses the expected roledefinition token instead of the localized name.

Written by the indexing model from the issue text.

Assessment

Tech stack
csharp, powershell
Domain
cli, tooling
Issue type
Bug
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.