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. General Programming
  3. C#
  4. Design question...

Design question...

Scheduled Pinned Locked Moved C#
questiondatabasedesignsecurity
2 Posts 1 Posters 0 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.
  • S Offline
    S Offline
    sharkfish
    wrote on last edited by
    #1

    I am a newbie at design, and I've been studying design patterns but I can't figure what to do in this case. I have a security object that has properties for a list of fields that also happen to be the properties of another object. class security { //"true" value for each property means yes, user has permission to access these fields in client bool ssNumber; bool hourlyRate; bool dateOfBirth; //getters and setters, functions to pull data from database, etc. } class empInfo { string ssNumber; decimal hourlyRate; DateTime dateOfBirth; //getters and setters, functions to pull data from database, etc. } I need empInfo to be aware as to which of its properties are considered permissible for access by a particular user. What would be the best way to tell if a particular property in empInfo is allowed access by the user? Should empInfo be extended to include security class and then when empInfo is instantiated and populated, grab security data then? Since each field represents a datacolumn on the web, I would like to keep as much data manipulation in the middle tier as possible. Thanks in advance!

    S 1 Reply Last reply
    0
    • S sharkfish

      I am a newbie at design, and I've been studying design patterns but I can't figure what to do in this case. I have a security object that has properties for a list of fields that also happen to be the properties of another object. class security { //"true" value for each property means yes, user has permission to access these fields in client bool ssNumber; bool hourlyRate; bool dateOfBirth; //getters and setters, functions to pull data from database, etc. } class empInfo { string ssNumber; decimal hourlyRate; DateTime dateOfBirth; //getters and setters, functions to pull data from database, etc. } I need empInfo to be aware as to which of its properties are considered permissible for access by a particular user. What would be the best way to tell if a particular property in empInfo is allowed access by the user? Should empInfo be extended to include security class and then when empInfo is instantiated and populated, grab security data then? Since each field represents a datacolumn on the web, I would like to keep as much data manipulation in the middle tier as possible. Thanks in advance!

      S Offline
      S Offline
      sharkfish
      wrote on last edited by
      #2

      What do you think of this (pseudocode)?:class empInfo { string ssNumber; decimal hourlyRate; DateTime dateOfBirth; securitySetter(empInfo) { securityCollection = security.getSecurity(empInfo); foreach (property prop in empInfo) { foreach {securityItem sItem in securityCollection) { if (sItem.access(prop)) { set.prop = "Not accessible"; //or set a code that I can read in the asp.net/forms interface in the datagrid } } } return empInfo } }
      ---- I'm concerned about handling the database calls, since building the securityCollection requires a trip to the database, then building the empInfo object requires a trip to the database. Or maybe this cannot be avoided. Cacheing security information for objects would also be memory intensive? Oh, and important...how can I do this so that ALL empInfo objects in a collection are taken care of for a particular session at one time, without having to re-set for each instantiation? Any advice is appreciated.

      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