Security tree structure
-
Hello brothers Just i m designing for helpdesk product. jsut think about . i have one department Department(Admin) . . ...... SupportTeams ( Support Teams having Support Users) . ........ SupportUser1 . ........ SupportUser2 and so.... User Team1(Means developer) , ......User1 . ..... User2 User Team2(Means developer) , ......User1 . ..... User2 Now my question is i want to give security for this tree structure. ..> Department Admin can access to all Like Support Teams and USer teams. ..> Support Teams can Access to Only Userteams Member. ..> Userteams Member can aceess only his profiles. Now can u tell me how could i create table for these flow tree structure.
Some Thing need 2 do NEW
-
Hello brothers Just i m designing for helpdesk product. jsut think about . i have one department Department(Admin) . . ...... SupportTeams ( Support Teams having Support Users) . ........ SupportUser1 . ........ SupportUser2 and so.... User Team1(Means developer) , ......User1 . ..... User2 User Team2(Means developer) , ......User1 . ..... User2 Now my question is i want to give security for this tree structure. ..> Department Admin can access to all Like Support Teams and USer teams. ..> Support Teams can Access to Only Userteams Member. ..> Userteams Member can aceess only his profiles. Now can u tell me how could i create table for these flow tree structure.
Some Thing need 2 do NEW
What best you can do is to create one table like ID DepartMent DepartMentData and make DepartMentData column as xml type where you will store data in the hierarchal way. For eg. There is an admin department so the DepartMentData column may have values like <Department Name = "Admin"> ------<SupportTeams> ----------<SupportUser Name ="SupportUser1" ID="1"> --------------<DeveloperTeam1> ------------------<User Name ="Dev1User1" ID="1"/> ------------------<User Name ="Dev1User2" ID="2"/> --------------</DeveloperTeam1> ----------</SupportUser> ----------<SupportUser Name ="SupportUser2" ID="2"/> --------------<DeveloperTeam2>; ------------------<User Name ="Dev2User1" ID="1"/> ------------------<User Name ="Dev2User2" ID="2"/> ---------------</DeveloperTeam2> -----------</SupportUser> ------</SupportTeams> </Department > Now in C# code you could pass the element you want to read Like for eg. you want to read all the users below SupportTeams then you just need to call: XmlNodeList ChilNodes = doc.GetElementsByTagName("SupportTeams") This will return all the child nodes including SupportTeams node. Now you can iterate through for each node foreach (XmlNode cNode in ChilNodes ) { } In the loop check that each node has further any child node by calling: if(cNode.ChilNodes!= null) This way you could ensure that you have not gone to above in the tree hierarchy. This will always go to below in the tree hierarchy.
-
Hello brothers Just i m designing for helpdesk product. jsut think about . i have one department Department(Admin) . . ...... SupportTeams ( Support Teams having Support Users) . ........ SupportUser1 . ........ SupportUser2 and so.... User Team1(Means developer) , ......User1 . ..... User2 User Team2(Means developer) , ......User1 . ..... User2 Now my question is i want to give security for this tree structure. ..> Department Admin can access to all Like Support Teams and USer teams. ..> Support Teams can Access to Only Userteams Member. ..> Userteams Member can aceess only his profiles. Now can u tell me how could i create table for these flow tree structure.
Some Thing need 2 do NEW
If you are using SQL 2008 (you don't mention the database) look into the hierarchy ID and it's methods.
Never underestimate the power of human stupidity RAH
-
If you are using SQL 2008 (you don't mention the database) look into the hierarchy ID and it's methods.
Never underestimate the power of human stupidity RAH
Right ... haven't looked in to the 2008 solution but in 2005 it's as simple as: ID SecurityName ParentID Then you can use hierarchal queries (recursive CTE or common table expressions) to unroll the tree. Example: http://www.eggheadcafe.com/articles/sql_server_recursion_with_clause.asp[^]
Jeremy Likness Latest Article: Hierarchal Data Templates in Silverlight Blog: C#er : IMage