Administrator operations

Administrator operations

Postby Silvio.Falconi » Mon Jun 07, 2021 9:08 am

to perform some operations the administrator needs exclusivity, so you should check if a user is online and / or the archives are open.

Does anyone have any idea how to go about doing these checks

Pls, a small sample to init
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm

Re: Administrator operations

Postby Otto » Mon Jun 07, 2021 10:28 am

Hello Silvio,
We have a central database from which we can lock the workstations.
But it always assumes that all users exit the program first.
Then it is no longer possible to open the program and the maintenance work can be carried out.
Best regards,
Otto



Code: Select all  Expand view  RUN

 METHOD PC_erfassen() CLASS TAllgemein
    local lapped := .t.
    *----------------------------------------------------------
   
    //hier werden alle WINHOTEL.exen registriert
    if file( Setup():Daten() + "dataallg\PCS.dbf" )= .F.
        DbCreate( Setup():Daten() + "dataallg\PCS.dbf",;
        {{"SERIALNR"   , "C",  20,   0} ,;
        {"BIOSDATE"    , "C",  10,   0} ,;
        {"COMPUTER"    , "C",   5,   0} ,;
        {"SPERRE"      , "C",  20,   0} ,;
        {"APPPATH"     , "C",  20,   0} ,;
        {"DATENVERZ"   , "C",  20,   0} ,;
        {"DATUM"       , "D",   8,   0} ,;
        {"ZEIT"        , "C",  10,   0}  })
    endif
    use ( Setup():Daten() + "dataallg\" + "PCS") NEW
    go top
    do while .not. eof()
        if (Upper(ALLTRIM(PCS->SERIALNR)) = Setup():cSerialHD) .and. (PCS->BiosDate = Setup():cBiosDate) .and.;
            ( Upper(ALLTRIM(PCS->AppPath))   =  Upper(ALLTRIM( Setup():AppPath )) )
            lapped := .f.
            exit
        endif
        select PCS
        skip
    enddo
    if lapped = .t.
        select PCS
        append_blank()
       
    endif
    if len(ALLTRIM(PCS->sperre)) > 0
        MetroMsgInfo( "
Infobox","Arbeitsstation gesperrt wg. " + PCS->sperre )
    return (.F.)
endif

IF rlock()
    PCS->SERIALNR  := Setup():cSerialHD
    PCS->computer  := Setup():cComputerNr
    PCS->BiosDate  := Setup():cBiosDate
    PCS->AppPath   := Setup():AppPath
    PCS->datenverz := Setup():DATEN
    PCS->DATUM     := date()
    PCS->zeit      := time()
    //   commit
   
else
return (.F.)

endif

select PCS
use

RETURN (.T.)
//----------------------------------------------------------------------------//





Image
********************************************************************
mod harbour - Vamos a la conquista de la Web
modharbour.org
https://www.facebook.com/groups/modharbour.club
********************************************************************
User avatar
Otto
 
Posts: 6332
Joined: Fri Oct 07, 2005 7:07 pm

Re: Administrator operations

Postby Silvio.Falconi » Mon Jun 07, 2021 10:51 am

I had thought of an archive where to insert all the archives worked by the application. If an archive is open, a warning message must be displayed.

Obviously the Check_Utenti procedure in addition to checking the open archives checks if a record in the Users archive has an asterisk in the Status field because when a user enters the application, the login checks and inserts an asterisk in a field and this is removed on exit.
therefore the user_check procedure must return a true or false logical variable of the type

function test()
local oDlt, lCont

cDbfPath:=cFilePath(GetModuleFileName( GetInstance() )) + "2013\dbf\"
cExePath:= cFilePath(GetModuleFileName( GetInstance() ))
* SET DEFAULT TO &cDbfPath

RddSetDefault( "DBFCDX" )

DEFINE DIALOG oDlt RESOURCE "Dlg_Tmp" //FONT oWnd:oFont
REDEFINE SAY PROMPT "Verificando utenti..." ID 10 OF oDlt
oDlt:bStart:={|| lCont:=CheckUsers(),oDlt:End()}
ACTIVATE DIALOG oDlt CENTERED
IF !lCont
msginfo("you can make admin operations")

.....( the admin operations)


ENDIF
RETURN (NIL)



it's just easier said than built
if i send you a file do you have a chance to try if it works?
Since from 1991/1992 ( fw for clipper Rel. 14.4 - Momos)
I use : FiveWin for Harbour November 2023 - January 2024 - Harbour 3.2.0dev (harbour_bcc770_32_20240309) - Bcc7.70 - xMate ver. 1.15.3 - PellesC - mail: silvio[dot]falconi[at]gmail[dot]com
User avatar
Silvio.Falconi
 
Posts: 7063
Joined: Thu Oct 18, 2012 7:17 pm


Return to FiveWin for Harbour/xHarbour

Who is online

Users browsing this forum: Google [Bot] and 58 guests