Do not input private or sensitive data. View Qlik Privacy & Cookie Policy.
Skip to main content

Announcements
Qlik Open Lakehouse is Now Generally Available! Discover the key highlights and partner resources here.
cancel
Showing results for 
Search instead for 
Did you mean: 
Not applicable

Current User at Section Access

Hi all,

I am trying to implement some restrictions to a "data island" at my QV application,

My application is restricted by Section access as seen bellow:

Section Access;

set HidePreffix = '_';

LOAD * INLINE [

    ACCESS, NTNAME, PASSWORD, _GRUPO, _GRUPO1, _GRUPO2

    ADMIN, ARQUIVOS\SUPORTE_TI, *, ADM, ADM, ADM

];

LOAD DISTINCT

  'ADMIN' as ACCESS,

  'DOMAIN\' & upper(trim(USU_LOGIN)) as NTNAME,

  '*'  as PASSWORD,

  If(upper(trim(USU_TIPREP)) = 'RTV', upper(trim(USU_LOGIN)), 'ADM') as _GRUPO,

  If(upper(trim(USU_TIPREP)) = 'SR', upper(trim(USU_LOGIN)), 'ADM') as _GRUPO1,

  If(upper(trim(USU_TIPREP)) = 'GCR', upper(trim(USU_LOGIN)), 'ADM') as _GRUPO2

FROM [..\TRA\REF\Usuario.QVD] (qvd);

Section Application;

I am applying those restrictions at Load time as you can see:

USUARIO_ATUAL:

noConcatenate

LOAD DISTINCT

  [Usuário] AS aUsuario,

  Login AS aLogin,

  Nome AS aNome,

  Tipo AS aTipo,

  Codigo AS aCodigo,

  Supervisor AS aSupervisor,

  Gerente AS aGerente,

  ADM AS aADM

FROM

  [..\TRA\REF\LogAcesso.qvd](qvd)

WHERE

  [Usuário]=Upper(OSUser());

LOG_ACESSOS_RTV:

NoConcatenate

LOAD

  *

FROM

  [..\TRA\REF\LogAcesso.qvd]

(qvd);

INNER JOIN

LOAD

  aCodigo AS Codigo

RESIDENT USUARIO_ATUAL

WHERE aTipo='RTV';

To get the current user I am using OSUser() function. It works at development time, but obviously do not works at server time. Doing a call to QVUser() function, it does not works too, cause my section access do not contains USERID field.

So, how can I get the current user logged in at QV access point to my QV application?

Thanks in advance

2 Replies
hic
Former Employee
Former Employee

You shouldn't make a restriction that way. Instead, you could add the field USUARIO to both the USUARIO_ACTUAL table and to the authorization table in Section Access. Then the reduction will be made automatically when the user opens the app. Make sure you use upper case in both tables.

You need to check the "Initial data reduction ..." under Document Properties -> Opening also.

HIC

Not applicable
Author

By some reasons and a complex user section access I cannot reduce my data.

I am using initial section selection by document properties option.

By the way, thanks in advance. I solve the problem using Set Analysis at my "data island" to charts with aggregation and straight table.