Handling DB record inheritence?

D

darrel

Not quite sure how to label what I'm specifically after.

I'm working on an in-house CMS and am now trying toattach permissions to
pages of the site. So, for instance, I have this:

page 1 - bob
page 2 - sarah
page 3 - john

On an individual basis, it's easy to check the permissions. For instance,
when loading up page 3 for editing, I can check to see if john has
permissions.

However, I'd like these permissions to inherit. In otherwords, both bob and
sarah should also have permission to edit page 3. however, bob and sarah
aren't connected to the page 3 record, so I'm trying to think of the most
efficient way to handle this.

The only solution I've come up with is to do a recursive backwords query:

dim strPermissions as string

function getPermissions(pageIDtoGrab)
SELECT user, parentID WHERE pageID = pageIDtoGrab
strPermissions = strPermissions + user
if not parentID = 0 then
getPermissions(parentID)
end if
end function

BUT, I know I'm supposed to avoid recursive functions if possible. Can I
avoid it in this case?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,011
Latest member
AjaUqq1950

Latest Threads

Top