Skip to content

Fix role permissions error in the sync scheduled task - #116

Draft
davidjrh with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-115
Draft

Fix role permissions error in the sync scheduled task#116
davidjrh with Copilot wants to merge 2 commits into
masterfrom
copilot/fix-115

Conversation

Copilot AI commented May 20, 2025

Copy link
Copy Markdown
Contributor

Background

When a role is deleted on EntraID, during the next sync cycle the DNN Local role associated with that role will be deleted. If that role has been used to give permissions to a specific workspace or report through the persona bar (storing the permissions in the PBI_ObjectPermissions table), the synchronization fails to delete the roles because the foreign key between PBI_ObjectPermissions and Roles is not set as DELETE CASCADE.

Solution

Added code to delete entries in the PBI_ObjectPermissions table before deleting the role itself. This approach is consistent with the existing workaround for RoleSettings that was already in the codebase.

The changes:

  1. Add a SQL statement to delete entries from the PBI_ObjectPermissions table for the role being deleted
  2. Execute this statement before the role deletion occurs
  3. Keep the existing workaround for RoleSettings intact

This prevents foreign key constraint violations when deleting roles that have been used for permissions in the persona bar.

Fixes #115.

Warning

Firewall rules blocked me from connecting to one or more addresses

I tried to connect to the following addresses, but was blocked by firewall rules:

  • _https._tcp.esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • _https._tcp.motd.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • esm.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)
  • motd.ubuntu.com
    • Triggering command: /usr/lib/apt/methods/https (dns block)

If you need me to access, download, or install something from one of these locations, you can either:


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Co-authored-by: davidjrh <489976+davidjrh@users.noreply.github.com>
Copilot AI changed the title [WIP] Role permissions error in the sync scheduled task Fix role permissions error in the sync scheduled task May 20, 2025
Copilot AI requested a review from davidjrh May 20, 2025 12:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Role permissions error in the sync scheduled task

2 participants