fnObjectRolesPrivs

Return

Return Type
table

Parameters

Parameter Parameter Type Mode Description
@CurrentUsersID int IN
@ClientsID int IN
@ObjectGuid uniqueidentifier IN

Definition

Copy

                CREATE  FUNCTION dbo.fnObjectRolesPrivs

      (
            @CurrentUsersID int,
            @ClientsID int,
            @ObjectGuid uniqueidentifier        
      )


    RETURNS TABLE RETURN

    SELECT TOP 100 PERCENT ClientRoles.ID ClientRolesID,ClientRoles.Name, 

          coalesce(canView,1) canview, 
          coalesce(canEdit,0) canedit, 
          coalesce(canAdd,0) canadd, 
          coalesce(canDelete,0) candelete, 
          coalesce(canSecure,0) cansecure,
          ClientRoles.EveryoneRole 

    FROM ClientRoles LEFT JOIN fnRoleObjectPrivsByGuid(@ObjectGuid) A

    ON ClientRoles.ID=A.ClientRolesID 

    WHERE ClientRoles.ClientsID=@ClientsID AND ClientRoles.Deleted=0

    ORDER BY ClientRoles.EveryoneRole DESC, ClientRoles.[Name]