How do you handle User Access on your FW App

How do you handle User Access on your FW App

Postby fraxzi » Sat Aug 18, 2018 6:49 am

Dear All,

How do you manage user privilege to access certain menu item / edit fields, etc. on your FW?

What is best suited structure? I dunno if I am asking the right question, help me out here.

Any Idea?
:idea: :idea: :idea:
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: How do you handle User Access on your FW App

Postby bpd2000 » Sat Aug 18, 2018 8:44 am

Simple logig is enable/disable Menu Item according to user's rights
Regards, Greetings

Try FWH. You will enjoy it's simplicity and power.!
User avatar
bpd2000
 
Posts: 153
Joined: Tue Aug 05, 2014 9:48 am
Location: India

Re: How do you handle User Access on your FW App

Postby fraxzi » Sat Aug 18, 2018 9:02 am

bpd2000 wrote:Simple logig is enable/disable Menu Item according to user's rights


Hi,

User menu/item is fine.. but what about get objects you define each object per user?

:?:
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines

Re: How do you handle User Access on your FW App

Postby Marc Venken » Sat Aug 18, 2018 9:41 am

I have a xbrowse for users previliges for menu's etc..

Image

When they login I read these into a array for granting access to things.

Code: Select all  Expand view  RUN

   aTPloegen := ArrTranspose( oRs:GetRows() )
   for i = 1 to len(aPloegen)
      aadd(aToegang,aTploegen[ 6+I ][1])  // 6 = aantal velden in de browse
   next
 


I use a simple loop for showing the buttons that are relevant for that user :

Code: Select all  Expand view  RUN

   lFirsttime:= .T.
   for i = 1 to len(aPloegen)
      if aToegang[i]
        nMove+=30

        if aPloegTypes[i] .and. lFirsttime
           lFirsttime:= .F.
           nMove:=30
           nTop:= 90
           nLeft:= 1195
        endif

        @ nTop+nMove,nLeft BTNBMP aBtn[i] OF oDlg SIZE 80, 25 NOBORDER PROMPT aPloegen[i] 2007 ACTION (oRs:SetFilter( "ploeg2018 = ? and exlid = ?", { ::cCaption, .F. } ), oBrw[oFld:nOption]:GoTop(), oBrw[oFld:nOption]:Refresh(),oBrw[oFld:nOption]:setfocus(),oPloeg:refresh(),oBrw[oFld:nOption]:maketotals() ) font oBold CENTER

      endif
   next

 


Or I disable the buttons itself

I also make groups of users for easy access to parts of the program.

There are surely better ways, but this is simple... Maybe there will come better sollutions.
Marc Venken
Using: FWH 23.04 with Harbour
User avatar
Marc Venken
 
Posts: 1447
Joined: Tue Jun 14, 2016 7:51 am
Location: Belgium

Re: How do you handle User Access on your FW App

Postby Rick Lipkin » Sat Aug 18, 2018 3:43 pm

Validating a user is not difficult .. first of all I use the function WnetGetUser:

Code: Select all  Expand view  RUN

xLOGIN := UPPER( WNetGetuser() )+space(15) // fivewin function
xLOGIN := SUBSTR(xLOGIN,1,15)
 


Take the results of xLogin and search your user table .. if you find a match .. like Marc mentions .. grant roles to that user based on your logic .. the only time I force a login is if the search for xLogin is not found ...

Image

WNetGetUser() returns the value of the user ( Rick Lipkin ) currently logged into their computer .. Assign the roles to variables :

xRead = "Y"
xWrite = "Y"
xMgr = "Y' ... etc

Then interrogate your variables in your menus or modules and enable or disable as appropriate.

Rick Lipkin
User avatar
Rick Lipkin
 
Posts: 2666
Joined: Fri Oct 07, 2005 1:50 pm
Location: Columbia, South Carolina USA

Re: How do you handle User Access on your FW App

Postby fraxzi » Wed Aug 22, 2018 3:50 am

Dear Gentlemen Mr. Marc and Mr. Rick,

Thanks for the great Idea :idea:

I got it sorted now.. defining :nID for each object I wish to control (enable/disable) defined in user table..
iterate these objects based also on defined :nID of Dialog/Window..

Before I used to define menu to access dialogs.. now I control object access per user.. great for multi-user-multi-task level control.

:wink: :wink: :wink:
Kind Regards,
Frances

Fivewin for xHarbour v18.07
xHarbour v1.2.3.x
BCC 7.3 + PellesC8 ( Resource Compiler only)
ADS 10.1 / MariaDB
Crystal Reports 8.5/9.23 DE
xMate v1.15
User avatar
fraxzi
 
Posts: 811
Joined: Tue May 06, 2008 4:28 am
Location: Philippines


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: FiveWiDi, Google [Bot], JoséQuintas and 44 guests