Skip to content

[Bug]: Cannot delete Portal when Portal Permissions exist #6434

@DanielBolef

Description

@DanielBolef

Is there an existing issue for this?

  • I have searched the existing issues

What happened?

I tried to delete a portal, but got a SQL error.

Steps to reproduce?

  1. Create a portal (Don't think you can delete a portal if your instance only has one)
  2. Create a role
  3. Set up at least one portal permission for that role
  4. (Try to) delete that portal via the sites menu

Current Behavior

Foreign key error on the RoleID column of the PortalPermission table, probably when trying to cascade delete roles for the portal in question.

Expected Behavior

Portal is deleted without error.

Relevant log output

Error executing SQL: ;Exec dbo.DeletePortalInfo @0
The DELETE statement conflicted with the REFERENCE constraint "FK_PortalPermission_RoleId". The conflict occurred in database "<my database>", table "dbo.PortalPermission", column 'RoleID'.

Anything else?

The FKs on PortalPermission are missing cascade delete on PortalId, PermissionId, RoleID, and UserID. I suspect this would happen if trying to delete the Portal, Permission, Role, or User associated with Portal Permissions.

Portal Permissions were added in 9.11.0 and not touched since, so this almost certainly affects all versions since then.

Affected Versions

9.13.8 (RC), 9.13.7 (latest release), 10.0.0 (RC)

What browsers are you seeing the problem on?

No response

Code of Conduct

  • I agree to follow this project's Code of Conduct

Metadata

Metadata

Assignees

No one assigned

    Type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions