[CRITICAL BUG CS 2007] - Deleting role causes "Role Not Found" error

[CRITICAL BUG CS 2007] - Deleting role causes "Role Not Found" error

  • This is kind of a nasty one. I've verified it on two separate CS2007 installations.  One is pre SP1 and one is post.  Please note that this bug completely takes down the site and requires database modifications to fix, so proceed at your own peril.

    Steps to reproduce:

    1.  Create a new role (make note of the GUID assigned to the role id, so you can get the site back up and running afterwards).
    2.  Go to the user permissions screen for any forum and add any permission to the new role.  I just chose "View"
    3.  Go back to "Manage Roles" and delete the role.
    4.  Exit the control panel.  Unless my installations are messed up, you should now see Role Not Found, and the site is essentially inaccessible.

    The cause appears to be that the role is deleted from the aspnet_Roles table, but it is not properly deleted from the cs_SectionPermissions and cs_ProductPermissions tables.  You will need to go into these tables and manually delete the rows corresponding to the GUID you hopefully recorded in step one.

     Matt

  • This post of yours helped us a lot today! We were getting this error and could fix it looking at your post.

    Thanks a lot!

  • Thank you for finding and reporting this issue.  I have filed it in our tracking system as item #1078.  Once I have a good solution I will let you know that it is complete and hopefully will provide the code that I used to fix this issue.

     

    Thanks,

  • Thanks Wyatt.  Glad to hear the developers are still alive and kicking Wink

  • Thanks for reporting this so clearly. A quick search of this site and some database meddling had my site back up and running in 10 minutes. Panic over.

    This is pretty obvious but it might help someone - I used this SQL query to find out which row/GUID needed deleting:

    SELECT     *
    FROM         dbo.cs_ProductPermissions
    WHERE     (RoleID NOT IN
                              (SELECT     RoleId
                                FROM          dbo.aspnet_Roles))

    Cheers,
    Leaf.

  • I have checked in a solution for this bug and it will be available in the next service pack.  The solution is to basically just remove the stale permissions from the cs_SectionPermissions and cs_ProductPermissions tables after deleting a role.

     

    Please let me know if you have any questions.

     

  • This was the perfect thread! The SQL query was very handy and after deleting the GUID from the ProductPermissions table, everything was back up and running. Thanks to all for the info.

  • Wyatt Preul
    I have checked in a solution for this bug and it will be available in the next service pack.  The solution is to basically just remove the stale permissions from the cs_SectionPermissions and cs_ProductPermissions tables after deleting a role.

    I just encountered a similar problem, but with CS2007.1. You need to check the roleID in cs_RoleQuotas when deleting roles. Else you will end up with the same error message when going to manage galleries.

    Gérard

    CorelDRAW.com - connecting users of the CorelDRAW family of products

  • I was attempting to copy our production CS database to a development environment just so that we have some real data in our dev environment. So I had our DBA do that, but now when I change to the new dev db in the connectionstring I could this infamous "ROLES NOT FOUND" error. This error doesn't appear to have anything (on the surface) to do with roles being deleted as nothing was deleted, and every GUID cs_SectionPermissions & cs_ProductPermissions matches up with aspnet_Roles. Ya know, there aren't any "floating" RoleIds. Is there anything else that could the source of this problem?? http://exchange.smarttech.com -> that's the live site in Prod. go CommunityServer! Thank!!