Unauthorized Access

This forum is now locked, since Gold Support is no longer offered.

Moderator: SourceGear

Locked
realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Unauthorized Access

Post by realtytrac » Thu Jul 07, 2005 1:21 pm

Currently, we are implementing an ASP.NET web application that has windows authentication along with impersonation. When I(the developer where the application is hosted) access this app, i have no problems viewing the vault information. Even if i go onto another machine and access the application with my credentials, i have no problem. However, when others access it using their own credentials, they get the following error:

System.UnauthorizedAccessException: Access to the path "SourceGear\Vault_1\PluginWebService\1F75180C-74A6-44C4-A46B-BBE2FE4DE5C5\jjohnson" is denied.

I am assuming that that path is on "jjohnson" local machine. We have impersonation though...he is coming into the web app as jjohnson with those credentials. Why would he not be able to access his own machine's local folders?

It seems that the problem occurs at this line of the code:
_myClient.SetActiveRepositoryID(r.RepID, _myClient.Connection.Username, r.UniqueRepID, true, true);


Also, please explain the difference between AccessLevelType.PluginWebService and AccessLevelType.Client when it comes to security and authenticiation using the API.

thank you

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Thu Jul 07, 2005 1:57 pm

This is most likely because you have a folder under documents and settings on the server machine for your user, and all of the other users do not. In your call to ClientInstance.Init(), supply a path to place the Vault state information, and make sure that it is to a folder that everyone has full control over.

There is no difference from the client side for client versus pluginwebservice. It's used as a way to keep the data separate.

realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Post by realtytrac » Thu Jul 07, 2005 5:41 pm

I am getting an "Object reference not set to an instance of an object." error on the .GetManagerFilename

vgr = _myClient.GetByDisplayVersionToNonWorkingFolder(vaultFile, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, "C:\\temp", vaultFile.Parent.FullPath, null);

string diskFileInVault = _myClient.GetManagedFilename(vgr[0].File);

This used to work, but now it doesn't work anymore?! I want to be able to pull old versions of the file. Is this conflicting with the cache on the local machine? How do i fix this?

thanks

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Thu Jul 07, 2005 7:02 pm

GetManagedFilename is supposed to get the file name of the file _in the working folder_. You aren't doing a get to a working folder, so it makes sense that it's throwing an error. If you want to get the disk path to the file that you just downloaded, do a Path.Combine("c:\\temp", vaultFile.Name)
If you want the repositlory path, then you can just use vaultFile.FullPath.

realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Post by realtytrac » Fri Jul 08, 2005 9:51 am

Will the GetByDisplayVersionToNonWorkingFolder() function grab the file from Vault? I would like to grab the file from Vault, whether it be an old version or a new version of the file, whether it be stored on my local cache or not. Does GetByDisplayVersionToNonWorkingFolder() do that?

I dont see any files getting saved to the directory i put in there. Instead, i'm getting the following error:

System.ArgumentOutOfRangeException: Length cannot be less than zero on the second of these two lines:

string localPath = @"C:\Documents and Settings\haider.sabri\Application Data\SourceGear\StorageBin";
vgr = _myClient.GetByDisplayVersionToNonWorkingFolder(vaultFile, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, localPath, vaultFile.Parent.FullPath, null);


jeremy_sg wrote:GetManagedFilename is supposed to get the file name of the file _in the working folder_. You aren't doing a get to a working folder, so it makes sense that it's throwing an error. If you want to get the disk path to the file that you just downloaded, do a Path.Combine("c:\\temp", vaultFile.Name)
If you want the repositlory path, then you can just use vaultFile.FullPath.

realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Post by realtytrac » Fri Jul 08, 2005 10:07 am

This was the whole stack:

System.ArgumentOutOfRangeException: Length cannot be less than zero. Parameter name: length at System.String.Substring(Int32 startIndex, Int32 length) at VaultClientOperationsLib.ClientInstance.ConvertPathToNonWorkingDiskPath(String fullPath, String ancestorFullPath, String ancestorDiskPath) at VaultClientOperationsLib.ClientInstance.ProcessFile_NonWorkingFolder(String tempFile, VaultClientFile file, VaultResponseGetFile response, String ancestorFullPath, String ancestorDiskPath, SetFileTimeType setFileTime, MakeWritableType makeWritable, MergeType merge, OverwritePrompt PromptData) at VaultClientOperationsLib.ClientInstance.ProcessGetFileRequests(GetFileInfo[] infos, MakeWritableType makeWritable, SetFileTimeType setFileTime, MergeType merge, Boolean updateHiddenFilesOnly, String ancestorFullPath, Boolean flat, String ancestorDiskPath, OverwritePrompt PromptData, Boolean isLabelGet, String currentPathToLabelItem, Int64 labelID, Boolean isRetry) at VaultClientOperationsLib.ClientInstance.GetByDisplayVersionToNonWorkingFolder(VaultClientFile[] files, MakeWritableType makeWritable, SetFileTimeType setFileTime, String ancestorFullPath, String ancestorDiskPath, OverwritePrompt PromptData) at VaultClientOperationsLib.ClientInstance.GetByDisplayVersionToNonWorkingFolder(VaultClientFile file, MakeWritableType makeWritable, SetFileTimeType setFileTime, String ancestorFullPath, String ancestorDiskPath, OverwritePrompt PromptData)

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Fri Jul 08, 2005 10:11 am

There was a bug in the code that I gave to you. Switch the positions of the vaultFile.Parent.FullPath and the disk path.
Last edited by jeremy_sg on Fri Jul 08, 2005 10:13 am, edited 1 time in total.

realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Post by realtytrac » Fri Jul 08, 2005 10:12 am

I changed the localPath to @"c:\temp" and i didn't get the above exception anymore, but that folder does not exists, nor does it create it, nor does it transfer the vault file to it???

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Fri Jul 08, 2005 10:14 am

I edited the message above to reflect what I think is the real bug.

realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Post by realtytrac » Fri Jul 08, 2005 10:17 am

i made that change (put null in place), but i'm getting this exception instead:

VaultClientOperationsLib.GetLatestVersionFailedException: Exception of type VaultClientOperationsLib.GetLatestVersionFailedException was thrown. at VaultClientOperationsLib.ClientInstance.ProcessGetFileRequests(GetFileInfo[] infos, MakeWritableType makeWritable, SetFileTimeType setFileTime, MergeType merge, Boolean updateHiddenFilesOnly, String ancestorFullPath, Boolean flat, String ancestorDiskPath, OverwritePrompt PromptData, Boolean isLabelGet, String currentPathToLabelItem, Int64 labelID, Boolean isRetry) at VaultClientOperationsLib.ClientInstance.GetByDisplayVersionToNonWorkingFolder(VaultClientFile[] files, MakeWritableType makeWritable, SetFileTimeType setFileTime, String ancestorFullPath, String ancestorDiskPath, OverwritePrompt PromptData) at VaultClientOperationsLib.ClientInstance.GetByDisplayVersionToNonWorkingFolder(VaultClientFile file, MakeWritableType makeWritable, SetFileTimeType setFileTime, String ancestorFullPath, String ancestorDiskPath, OverwritePrompt PromptData) at Vault.VaultVDD.RetrieveFiles(String VDDNumber, String DestinationFolder, String VaultFolder)

jeremy_sg
Posts: 1821
Joined: Thu Dec 18, 2003 11:39 am
Location: Sourcegear
Contact:

Post by jeremy_sg » Fri Jul 08, 2005 10:24 am

I was wrong about using null. The only bug should be that the call should look like

Code: Select all

_myClient.GetByDisplayVersionToNonWorkingFolder(vaultFile, MakeWritableType.MakeAllFilesWritable, SetFileTimeType.Current, vaultFile.Parent.FullPath, localPath, null); 

realtytrac
Posts: 34
Joined: Wed Jun 15, 2005 2:07 pm

Post by realtytrac » Fri Jul 08, 2005 10:28 am

my bad. yeah that worked. i switched them around, and they started copying locally. now i just checked it. Great!!! thanks for the help jeremy

Locked