Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass access rights
Message
 
À
02/12/2004 05:24:10
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
00966298
Message ID:
00966390
Vues:
7
Hi Kari,

Don't know all your security requirements, but, instead of code posted below, is it possible to just copy the required Word Doc to some temporary folder that is accessible by User_A and open it from there?

>Hi,
>I have folder full of Word documents. User_A has no rights in that folder. User_B has full rights.
>
>I'm looking for this behaviour:
>1. User_A starts my application
>2. Application gives User_A same rights as User_B has
>3. Application opens document in Word
>
>Problem: Word cannot open the document.
>
>Here is the code, based on example in Wiki http://fox.wikis.com/wc.dll?Wiki~RunAsAnotherUser~VFP
>
>
>
>#define LOGON32_PROVIDER_DEFAULT 0
>#define LOGON32_LOGON_INTERACTIVE 2
>#define LOGON32_LOGON_NETWORK 3
>#define LOGON32_LOGON_BATCH 4
>#define LOGON32_LOGON_SERVICE 5
>#define LOGON32_LOGON_UNLOCK 7
>
>DECLARE integer LogonUser IN AdvApi32.DLL;
> string szUsername,;
> string lpszDomain,;
> string lpszPassword,;
> integer dwLogonType,;
> integer dwLogonProvider,;
> integer @phToken
>
>DECLARE integer ImpersonateLoggedOnUser IN AdvApi32.DLL integer hToken
>DECLARE integer RevertToSelf IN AdvApi32.DLL
>
>nToken = 0
>? LogonUser("username","domain","password",LOGON32_LOGON_INTERACTIVE, LOGON32_PROVIDER_DEFAULT, @nToken)
>? nToken
>? ImpersonateLoggedOnUser(nToken)
>
>loWord = CREATEOBJECT( 'word.application' )
>loWord.Visible = .T.
>loWord.Documents.Open( "\\server\resource\folder\worddocument.doc" )
>
>
>Is it possible to pass current access rights to loWord? Or impersonate again with OLE?
>
>Thanks,
>Kari
Nick Neklioudov
Universal Thread Consultant
3 times Microsoft MVP - Visual FoxPro

"I have not failed. I've just found 10,000 ways that don't work." - Thomas Edison
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform