Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Other Discussions
  3. The Weird and The Wonderful
  4. I *suppose* that's a way of determining read permissions..

I *suppose* that's a way of determining read permissions..

Scheduled Pinned Locked Moved The Weird and The Wonderful
5 Posts 3 Posters 40 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • E Offline
    E Offline
    Erik Burger
    wrote on last edited by
    #1

    /* does the user have read permissions on the file */ try { FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read); using (fs) { fs.Close(); } } catch (Exception){continue;} And these are people I am actually supposed to work with :^) Ad. Btw the 'user' mentioned here doesn't even exist..this is code running in a Windows NT Service. What the author wants to do (I think :confused:) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.

    D 1 Reply Last reply
    0
    • E Erik Burger

      /* does the user have read permissions on the file */ try { FileStream fs = new FileStream(name, FileMode.Open, FileAccess.Read); using (fs) { fs.Close(); } } catch (Exception){continue;} And these are people I am actually supposed to work with :^) Ad. Btw the 'user' mentioned here doesn't even exist..this is code running in a Windows NT Service. What the author wants to do (I think :confused:) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.

      D Offline
      D Offline
      David Crow
      wrote on last edited by
      #2

      ErikDD wrote:

      What the author wants to do (I think ) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.

      And your solution would be??


      "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

      "Judge not by the eye but by the heart." - Native American Proverb

      E 1 Reply Last reply
      0
      • D David Crow

        ErikDD wrote:

        What the author wants to do (I think ) is see if the user for whom he's retrieving the list of files has read permissions on the file, not the Windows NT User the Service is running under.

        And your solution would be??


        "Approved Workmen Are Not Ashamed" - 2 Timothy 2:15

        "Judge not by the eye but by the heart." - Native American Proverb

        E Offline
        E Offline
        Erik Burger
        wrote on last edited by
        #3

        Ah, I'd have to admit that I have no idea :-O Afaik, this is one of the things that despite the power of the .NET Framework is still either very difficult or misunderstood. I'd start my search in the FileIOPermission and the WindowsPrincipal/-Identity classes and see where I end up from there. Might be completely wrong though. In any case the above check checks the Windows NT Service account's access, not the requested user's.

        P 1 Reply Last reply
        0
        • E Erik Burger

          Ah, I'd have to admit that I have no idea :-O Afaik, this is one of the things that despite the power of the .NET Framework is still either very difficult or misunderstood. I'd start my search in the FileIOPermission and the WindowsPrincipal/-Identity classes and see where I end up from there. Might be completely wrong though. In any case the above check checks the Windows NT Service account's access, not the requested user's.

          P Offline
          P Offline
          peterchen
          wrote on last edited by
          #4

          Clickety[^] :) [edit]I forgot: read the discussion, too...


          Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
          We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
          Linkify!|Fold With Us!

          E 1 Reply Last reply
          0
          • P peterchen

            Clickety[^] :) [edit]I forgot: read the discussion, too...


            Developers, Developers, Developers, Developers, Developers, Developers, Velopers, Develprs, Developers!
            We are a big screwed up dysfunctional psychotic happy family - some more screwed up, others more happy, but everybody's psychotic joint venture definition of CP
            Linkify!|Fold With Us!

            E Offline
            E Offline
            Erik Burger
            wrote on last edited by
            #5

            Brilliant! I'll give this to my colleague to break his head over ;)

            1 Reply Last reply
            0
            Reply
            • Reply as topic
            Log in to reply
            • Oldest to Newest
            • Newest to Oldest
            • Most Votes


            • Login

            • Don't have an account? Register

            • Login or register to search.
            • First post
              Last post
            0
            • Categories
            • Recent
            • Tags
            • Popular
            • World
            • Users
            • Groups