Unauthorized Access
Moderator: SourceGear
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 pm
Unauthorized Access
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
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
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.
There is no difference from the client side for client versus pluginwebservice. It's used as a way to keep the data separate.
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 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
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
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.
If you want the repositlory path, then you can just use vaultFile.FullPath.
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 pm
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);
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.
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 pm
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)
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)
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.
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 pm
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 pm
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)
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)
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);
-
- Posts: 34
- Joined: Wed Jun 15, 2005 2:07 pm