0

I found this script and find it is very helpful to me. I am new here and not good in coding. Can someone explain to me the below script the **'{All Users}'means? represent of? Appreciate your answer and reply. Thank you very much!

--List all access provisioned to the public role, which everyone gets by default

SELECT  
    [UserName] = **'{All Users}',**
    [UserType] = **'{All Users}'**, 
    [DatabaseUserName] = '{All Users}',       
    [Role] = roleprinc.[name],      
    [PermissionType] = perm.[permission_name],       
    [PermissionState] = perm.[state_desc],       
    [ObjectType] = obj.type_desc,--perm.[class_desc],  
    [ObjectName] = OBJECT_NAME(perm.major_id),
    [ColumnName] = col.[name]
FROM    
    --Roles
    sys.database_principals roleprinc
LEFT JOIN

Gwen
  • 1
  • can you show us where you got this from the query should more look like https://dataedo.com/kb/query/sql-server/list-users-in-database – nbk Mar 29 '21 at 13:13
  • I found the scripts from below – Gwen Mar 30 '21 at 06:51
  • https://dba.stackexchange.com/questions/36618/list-all-permissions-for-a-given-role – Gwen Mar 30 '21 at 06:51

1 Answers1

1

This refers to the role public.

every user gets this role, and so the rights that the role public has, are valid for all users, so there is no singular username shown in the result only the text `{All Users}´

nbk
  • 8,191
  • 5
  • 13
  • 27
  • UserType DatabaseUserName LoginName Role PermissionType PermissionState ObjectType Schema ObjectName {All Users} {All Users} {All Users} public SELECT GRANT SQL_INLINE_TABLE_VALUED_FUNCTION cdc fn_cdc_get_all_xxxxxxx – Gwen Mar 31 '21 at 11:50
  • Thanks nkb for your answer. Please how to explain why usertype, databasename and loginname all appear as `{All Users}´ and role is public? if role is public means? please help! thanks – Gwen Mar 31 '21 at 11:52
  • Can change the `{All Users}´ to other more meaningful one – Gwen Mar 31 '21 at 12:41
  • it is simply because public ha no user type and no DatabaseUserName and to clarify it, the author wrote all users, so that it is cölearly that the permissions belong to all users – nbk Mar 31 '21 at 14:31
  • And that is simp,y text change it tio whta ever you like, but when you run it , you see that is comprehensive – nbk Mar 31 '21 at 21:06
  • Thank you very much for your answer to me! really appreciate. I am learning. thank you! – Gwen Apr 14 '21 at 09:55
  • @Gwen if it was helpful please accept the answer – nbk Apr 14 '21 at 12:06