Progarm to check menu access in qad ee version

/*program to check if user test have access to menu journal entry create*/

{us/mf/mfdtitle.i}

define temp-table ttvrl no-undo
  Field ttvrl_role as character
  Field ttvrl_id   as Integer.


define variable m_usr as character no-undo.
define variable m_avl as Logical   no-undo.

Assign
  m_usr = "test".

For First mnd_det no-lock where mnd_nbr = "25.13.1" and mnd_select = 1 :
    For each resource where resourceUri = mnd_uri no-lock :
        For each roleresource where roleresource.resource_id = resource.resource_id no-lock :
             For first role where role.role_id = roleresource.role_id and RoleIsActive no-lock :
                if can-find (First ttvrl where ttvrl_role = role.rolename ) then .
                else
                do:
                    Message role.rolename view-as alert-box.
                    create ttvrl.
                     Assign
                        ttvrl_role    = role.rolename
                        ttvrl_id      = role.role_id.
                end.
            End.
        End.
    End.
End.

Assign
    m_avl = no.

Message " check " view-as alert-box.

For First usr where usrLogin = m_usr no-lock :
    Message " role " view-as alert-box.
    For each usrrole where usrrole.Usr_ID = usr.usr_id no-lock :
       For First role where role.role_id = usrrole.role_id no-lock :
           Message " usr " rolename view-as alert-box.
       End.

       For First ttvrl where ttvrl_id = usrrole.role_id no-lock :
       End.
       if avail ttvrl then
       do:
           Assign
                         m_avl = YES.
                  leave.
       end.
    End. /*userrole*/
End. /*user*/

Message m_avl view-as alert-box

Comments

Popular posts from this blog

Progress 4GL interview questions for QAD technology

QAD interview questions for SE and Eb2 version

Use of API in QAD EE