USP_SEARCH_DATALISTFORAPPUSER

Returns a list of data lists matching the specified criteria and to which the current user has rights.

Parameters

Parameter Parameter Type Mode Description
@CURRENTAPPUSERID uniqueidentifier IN Input parameter indicating the ID of the current user.
@NAME nvarchar(255) IN Name
@MAXROWS smallint IN Input parameter indicating the maximum number of rows to return.

Definition

Copy


CREATE procedure dbo.USP_SEARCH_DATALISTFORAPPUSER
(
    @CURRENTAPPUSERID uniqueidentifier,
    @NAME nvarchar(255) = '',
    @MAXROWS smallint = 500
)
as
    set nocount on;

    set @NAME = dbo.UFN_SEARCHCRITERIA_GETLIKEPARAMETERVALUE(@NAME, 0, null);

    declare @ISSYSADMIN bit;    
    select @ISSYSADMIN = ISSYSADMIN from dbo.APPUSER where ID = @CURRENTAPPUSERID;

    select top(@MAXROWS
        ID,
        UINAME as NAME
    from dbo.V_INSTALLED_DATALISTCATALOG
    where ((@NAME is null) or (UINAME like @NAME))
        and (@ISSYSADMIN = 1 or dbo.UFN_SECURITY_APPUSER_GRANTED_DATALIST_IN_SYSTEMROLE(@CURRENTAPPUSERID, ID) = 1)
    order by NAME;