OK, I have a table called permissions in SQL, and I want someone to write me some code to help me retrieve data from it.
Structure is as follows:
Columns (all INTEGER unless otherwise specified)
FROM_A
FROM_B
FROM_C
FROM_D
TO_A
TO_B
TO_C
TO_D
propogate_permission (BIT)
Permissions are granted FROM_X to TO_X by having the same number in both columns so permission granted for 66 would be FROM_A = 66 and in the same row TO_B = 66
I want to be able to retrieve all TO_X results but, and this is the bit that is particularly tricky. TO_A may have been granted through a more complicated relationship for example Permission is given FROM_B to TO_C. Then FROM_C = TO_D and then TO_D = TO_A.
I suspect there are an infinite number of permutations for this but we need to be able to collect all of the TO_X results. We want 4 queries in total, one for all of the TO_A results, then all of TO_B, all of TO_C and finally TO_D
Propogate field if checks means the relationship propogates through, but if the propogate field is not checked then we need to record this lack of propogation in the result.
If necessary, the code can be written in VB.NET so you can store an array of the results and then use the array to re-query the SQL.
Hopfully the complexity of the problem is clear from above
Results should be DISTINCT, sorry, forgot to mention that.
Also, to prove you have read the specification please include the word COBRA in your response