AugForums.com

An Acumatica User Group

  • Free
    • Start Here
    • Rolodex
    • Podcast
    • Blog
    • Forums
  • Paid
    • AugSQL
    • GI Course
    • GI Library
    • Consulting
  • Register
Acumatica Forums

By using this website, you agree to our Terms of Use (click here)

Forums
AugSQL
AugSQL
Row Level Security ...
 
Notifications
Clear all

Row Level Security Groups

 
Votes Received: 0

AugSQL
Last Post by Tim Rodman 5 months ago
1 Posts
1 Users
0 Reactions
30 Views
RSS
Tim Rodman
Posts: 3193
 Tim Rodman
Admin
Topic starter
February 8, 2025 3:12 am
(@timrodman)
Famed Member
Joined: 10 years ago

I haven't had a chance to test this personally, but a friend sent this to me and he knows his stuff so I'm comfortable posting it here.

Row Level security information gets stored in a complicated format in the Acumatica database so it's hard to report on with SQL.

Here are two SQL Views that can help you to untangle the mystery:

CREATE OR ALTER VIEW dbo.RDPViewsUserRelationGroups AS
select
      U.CompanyID,
      U.Username,
      RG.GroupName,
      RG.Description
from Users U
      left outer join RelationGroup RG on RG.CompanyID = U.CompanyID and (
            CONVERT(BIGINT, substring(RG.GroupMask, 1, 4)) & CONVERT(BIGINT, substring(U.GroupMask, 1, 4)) != 0 or
            CONVERT(BIGINT, substring(RG.GroupMask, 5, 4)) & CONVERT(BIGINT, substring(U.GroupMask, 5, 4)) != 0 or
            CONVERT(BIGINT, substring(RG.GroupMask, 9, 4)) & CONVERT(BIGINT, substring(U.GroupMask, 9, 4)) != 0 or
            CONVERT(BIGINT, substring(RG.GroupMask, 13, 4)) & CONVERT(BIGINT, substring(U.GroupMask, 13, 4)) != 0
      )

 

 

CREATE OR ALTER VIEW dbo.RDPViewsCustomerRelationGroups AS
select
      BA.CompanyID,
      BA.BAccountID,
      BA.AcctCD,
      BA.AcctName,
      RG.GroupName,
      RG.Description
from Customer C
      inner join BAccount BA on BA.CompanyID = C.CompanyID and BA.BAccountID = C.BAccountID
      left outer join RelationGroup RG on RG.CompanyID = C.CompanyID and (
            CONVERT(BIGINT, substring(RG.GroupMask, 1, 4)) & CONVERT(BIGINT, substring(C.GroupMask, 1, 4)) != 0 or
            CONVERT(BIGINT, substring(RG.GroupMask, 5, 4)) & CONVERT(BIGINT, substring(C.GroupMask, 5, 4)) != 0 or
            CONVERT(BIGINT, substring(RG.GroupMask, 9, 4)) & CONVERT(BIGINT, substring(C.GroupMask, 9, 4)) != 0 or
            CONVERT(BIGINT, substring(RG.GroupMask, 13, 4)) & CONVERT(BIGINT, substring(C.GroupMask, 13, 4)) != 0
      )
Forum Jump:
  Previous Topic
Forum Information
Recent Posts
Unread Posts
Tags
  • 12 Forums
  • 2,521 Topics
  • 10.9 K Posts
  • 21 Online
  • 2,321 Members
Our newest member: Courtney Wilder
Latest Post: Can UDFs be populated using an Import Scenario?
Forum Icons: Forum contains no unread posts Forum contains unread posts
Topic Icons: Not Replied Replied Active Hot Sticky Unapproved Solved Private Closed

Online Members

 No online members at the moment

Acumatica Forums

Terms of Use & Disclaimers :: Privacy Policy

Copyright © 2025 · AUG Forums, LLC. All rights reserved. This website is not owned, affiliated with, or endorsed by Acumatica, Inc.

‹›×

    ‹›×