Re: Restricting OpenFileDialog operations.
- From: "Nicole Calinoiu" <calinoiu REMOVETHIS AT gmail DOT com>
- Date: Tue, 6 Dec 2005 09:16:02 -0500
In that case, creating your own read-only UI as Kevin suggested is probably
your best bet. To keep things as safe as possible, the UI itself should run
under the account of the interactive user, with only the file reading
operations running under the impersonated account.
"Martin Hart Turner" <"martin _dot_ hartturner _at_ gmail.com"> wrote in
message news:et3J52O%23FHA.1032@xxxxxxxxxxxxxxxxxxxxxxx
> Nicole:
>
> There is plenty of food for thought here, so let me explain what I'm
> trying to achieve/restrict.
>
> The program will be a .NET 2.0 WinForms application, using SQL Server 2005
> as the database.
>
> My program will be installed in a folder structure similar to this:
> \\ServerName\SharedFolder\ProgramRoot
>
> with the data in subdirectories like:
> \\ServerName\SharedFolder\ProgramRoot\Company1
> \\ServerName\SharedFolder\ProgramRoot\Company2
> etc.
>
> I will be using impersonation to run the program so I can restrict the
> folders where the user can access via the OS, but the program can still
> read/write/create/delete files in the restricted folders.
>
> There are a few places in the program where I let the user select files to
> open/save via the common dialogs (OpenFileDialog etc.) As the program is
> running impersonating a higher level user, the user can access areas where
> I *only* want them to pick a file, but *not* copy/cut/delete/rename
> anything. This is where the restrictions come in.
>
> Should I be looking for other solutions, or is this a valid scenario?
>
> TIA,
> MartinH.
>
>
> Nicole Calinoiu escribió:
>> This is definitely not possible via the functionality exposed by the
>> managed wrapper classes. It might be possible via customization of the
>> dialogs
>> (http://msdn.microsoft.com/library/default.asp?url=/library/en-us/winui/winui/windowsuserinterface/userinput/commondialogboxlibrary/aboutcommondialogboxes/openandsaveasdialogboxes.asp).
>> (BTW, I've never personally attempted the exact change you seem to want,
>> so I can't vouch that it's actually possible via file dialog
>> customization.)
>>
>> That said, it sounds to me like you might be barking up the wrong tree
>> here. Even if you can manage to tweak the dialog behaviour, there's
>> presumably nothing stopping the interactive user (or even another user
>> with permissions on the same set of directories and/or files) from
>> modifying the target directory contents while the user happens to be
>> using the file dialog in your application.
>>
>> If the user shouldn't be able to modify the directory contents, his
>> account shouldn't have anything but read permissions on the directory and
>> its contents. If any account should be able to modify the directory
>> contents, then your application should probably be able to written to
>> cope with any changes that might occur between the opening of a file
>> dialog and the app's processing of any files selected in that dialog. If
>> you're not sure what would be the best approach in your application,
>> perhaps you might be able to describe why you're concerned about users
>> making changes via the file dialogs in the first place?
>>
>>
>>
>> "Martin Hart Turner" <"martin _dot_ hartturner _at_ gmail.com"> wrote in
>> message news:%23NpYJOM%23FHA.2036@xxxxxxxxxxxxxxxxxxxxxxx
>>> Hi:
>>>
>>> What I want to do is launch an OpenFileDialog/SaveFileDialog so the user
>>> can select a path/file. Once the user pushes 'OK' I'll do the work
>>> behind the scenes of loading or saving the file.
>>>
>>> What I don't want, is for the user to be able to delete or copy/cut
>>> files/ folders, or do any drag & drop operations while they have the
>>> OpenFileDialog o SaveFileDialog open.
>>>
>>> Is this possible?
>>>
>>> TIA,
>>> MartinH.
>>
.
- Follow-Ups:
- Re: Restricting OpenFileDialog operations.
- From: Martin Hart Turner
- Re: Restricting OpenFileDialog operations.
- References:
- Restricting OpenFileDialog operations.
- From: Martin Hart Turner
- Re: Restricting OpenFileDialog operations.
- From: Nicole Calinoiu
- Re: Restricting OpenFileDialog operations.
- From: Martin Hart Turner
- Restricting OpenFileDialog operations.
- Prev by Date: RE: Is it possible to throw an exception into parent thread?
- Next by Date: Re: Restricting OpenFileDialog operations.
- Previous by thread: Re: Restricting OpenFileDialog operations.
- Next by thread: Re: Restricting OpenFileDialog operations.
- Index(es):
Relevant Pages
|