Updating the Page Permission of a Specific Role Through the Database

Please follow the steps below:

  1. Run the following query, and note down the RoleID and PortalID.
     
    SELECT * FROM Roles R 
    INNER JOIN PortalAlias PA 
    ON R.portalid = PA.PortalID
     
    2020-02-21_1027.png
     
  2. Run the following query, and note down the PermissionID.
     
    SELECT * FROM Permissions
     
    2020-02-21_1027_001.png
     
  3. Run the following query, and note down the TabID.
    Replace # with the PortalID and the 'test' with the page name:
     
    SELECT * 
    FROM   tabs 
    WHERE  portalid = # 
           AND tabname = 'test' 
     
    2020-02-21_1046_001.png
     
  4. Update the TabPermission table by running the following query with the information you have gathered. 
    Replace the # signs with the relevant IDs. 
      
    DECLARE @RoleID AS INT = #
    DECLARE @TabID AS INT = #
    DECLARE @PermissionID AS INT = #

    IF NOT EXISTS (SELECT * FROM [TabPermission] WHERE Roleid= @RoleID and PermissionID = @PermissionID)
                BEGIN
                     INSERT INTO [dbo].[TabPermission]
                                     ([TabID]
    ,[PermissionID]
    ,[AllowAccess]
    ,[RoleID])
                                 VALUES
                                     (@TabID
    ,@PermissionID
    ,1
    ,@RoleID)
                END
     
    2020-02-21_1046.png

 

Back to top


 

Comments

0 comments

Please sign in to leave a comment.