Can we query the security module tables?

** self-hosted organization*

I need to provide my coworker with a list of users who can see the plans screen, and we have over 20 user groups, so I need a way figure this out other than going to every single user group. Is there another way?

Ashley Elliott

Database Administrator

St. Louis Symphony Orchestra

314-286-4198

ashleye@slso.org

Parents
  • Hi Ashley,

    I got this code from someone on the network quite some time ago, sorry I don't know who I can give the credit to but it has been a great help to me. I save the results and use them in Excel with filters or a pivot table to get the information I am looking for.  

    Use impresario

    select ug.UG_id

    , ug.UG_name

    , ao.object_id object_id

    , ao.name object

    , ao.object_type

    , isnull(sr.id, 0) rights_id

    , ISNULL(sr.adding,'') as 'adding'

    , ISNULL(sr.deleting,'') as 'deleting'

    , ISNULL(sr.editing,'') as 'editing'

    , ISNULL(sr.viewing,'') as 'viewing'

    ,ISNULL(d.short_desc,'') as 'constituency'

    from T_METUSERGROUP ug

    cross join T_APP_OBJECTS ao

    left outer join TX_SECURITY_RIGHTS sr on sr.UG_id = ug.UG_id and sr.object_id = ao.object_id

    left outer join tr_constituency d on sr.constituency=d.id

    order by  ug.UG_name , ao.name

  • Ashley here is the code again with the tables added in that Michael suggested to get the user names.  I also added a few where clauses you can turn on or off if you are looking for a particular user group or object. 

    Use impresario
    select ug.UG_id
    , ug.UG_name
    , ao.object_id object_id
    , ao.name object
    , ao.object_type
    , us.lname
    , us.fname
    , isnull(sr.id, 0) rights_id
    , ISNULL(sr.adding,'') as 'adding'
    , ISNULL(sr.deleting,'') as 'deleting'
    , ISNULL(sr.editing,'') as 'editing'
    , ISNULL(sr.viewing,'') as 'viewing'
    ,ISNULL(d.short_desc,'') as 'constituency'
    from T_METUSERGROUP ug
    cross join T_APP_OBJECTS ao
    left outer join TX_SECURITY_RIGHTS sr on sr.UG_id = ug.UG_id and sr.object_id = ao.object_id
    left outer join tr_constituency d on sr.constituency=d.id
    left outer join tx_user_group gr on gr.UG_id = ug.ug_id
    left outer join t_metuser us on us.userid = gr.userid
    --where UG_Name = 'Type User Group Name here' --use this to look for a particular user group by it's full name
    --where ao.name like '%Type object name here%' --this is the object field use this to find a particular object by any part of its name
    order by ug.UG_name , ao.name

Reply
  • Ashley here is the code again with the tables added in that Michael suggested to get the user names.  I also added a few where clauses you can turn on or off if you are looking for a particular user group or object. 

    Use impresario
    select ug.UG_id
    , ug.UG_name
    , ao.object_id object_id
    , ao.name object
    , ao.object_type
    , us.lname
    , us.fname
    , isnull(sr.id, 0) rights_id
    , ISNULL(sr.adding,'') as 'adding'
    , ISNULL(sr.deleting,'') as 'deleting'
    , ISNULL(sr.editing,'') as 'editing'
    , ISNULL(sr.viewing,'') as 'viewing'
    ,ISNULL(d.short_desc,'') as 'constituency'
    from T_METUSERGROUP ug
    cross join T_APP_OBJECTS ao
    left outer join TX_SECURITY_RIGHTS sr on sr.UG_id = ug.UG_id and sr.object_id = ao.object_id
    left outer join tr_constituency d on sr.constituency=d.id
    left outer join tx_user_group gr on gr.UG_id = ug.ug_id
    left outer join t_metuser us on us.userid = gr.userid
    --where UG_Name = 'Type User Group Name here' --use this to look for a particular user group by it's full name
    --where ao.name like '%Type object name here%' --this is the object field use this to find a particular object by any part of its name
    order by ug.UG_name , ao.name

Children