Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass access rights
Message
De
03/12/2004 13:48:28
 
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:
00966788
Vues:
7
Thanks Nick,

I would rather open the document in its original location, because User_A is supposed to make changes and save. And there might be User_C trying to save his changes in the same document.

My application should be the only way to access documents in that folder. I think some trick just after createobject would be the optimal solution because I would like to use automation to make some find&replace operations.

But, even if I could only open the document in Word "as User_B", it would be nice.

-Kari


>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
Précédent
Répondre
Fil
Voir

Click here to load this message in the networking platform