Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
How to pass access rights
Message
De
02/12/2004 05:24:10
 
 
À
Tous
Information générale
Forum:
Visual FoxPro
Catégorie:
COM/DCOM et OLE Automation
Titre:
How to pass access rights
Versions des environnements
Visual FoxPro:
VFP 8 SP1
Divers
Thread ID:
00966298
Message ID:
00966298
Vues:
65
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
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform