Restricting folder access based on membership level

12 posts by 3 authors in: Forums > CMS Builder: Plugins & Add-ons
Last Post: May 11, 2010   (RSS)

By gkornbluth - May 7, 2010

Hi all,

I have a membership site with a number of sets of folders that I'd like to be able to restrict access to depending on a user's membership level.

I know that I can restrict access to specific files to a particular membership level, but I'm not sure how I would restrict access to entire folders to those same membership levels.

Thahks,

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Restricting folder access based on membership level

By Maurice - May 10, 2010

Found a great solution as a alternative for the membership plugin.



http://www.webscripthub.com/web/_log_me_in

have fun
-------------------------------------------

Dropmonkey.nl

Re: [Maurice] Restricting folder access based on membership level

By gkornbluth - May 10, 2010

Thanks Maurice,

I really wanted to keep the entire process in CMSB

Jerry Kornbluth
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Restricting folder access based on membership level

By Dave - May 11, 2010

Hi Jerry,

One way to do it would be to create a multi-value pulldown in the user accounts table called "Folders" and for each user select the folders you want them to have access to.

Then, in your viewer code you'd get the name of the current folder and see if it was in that list. If it wasn't you'd deny access or display an error message.

Would that work for you?
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Restricting folder access based on membership level

By gkornbluth - May 11, 2010

Dave,

Thanks for getting back to me on this.

I'm not sure what you mean by "get the name of the current folder and see if it was in that list"

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Restricting folder access based on membership level

By Dave - May 11, 2010

Hi Jerry,

The first step is to figure out how you'd like it to work. Would you like it to work that any files under a certain folder are restricted to certain users?

So you might have:
/folderA/(many files and viewers)
/folderB/(many files and viewers)
/folderC/(many files and viewers)

Or is there some other structure?

If it's like I described then the next step would be to get some generic code that gets the current folder name or parent folder name that you want to use as an identifier to restrict access.

Let me know how you want it setup.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Restricting folder access based on membership level

By gkornbluth - May 11, 2010

Hi Dave,

/folderA/(many files and viewers)
/folderB/(many files and viewers)
/folderC/(many files and viewers)

is correct.

One group of members has access to Folder A only,

Another group of members has access to anything in Folders A and B

Another group might have access to folders A and C or just folder C

If you can give me some code to get me started on the one folder and 2 folder groups, I can work out the exact access logic.

Thanks again,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php

Re: [gkornbluth] Restricting folder access based on membership level

By Dave - May 11, 2010

Jerry, the first step is to extract the folder name. To do that we'll need to know the filepath.

Create a script in one of the folders called with this:
<?php echo __FILE__; ?><br/>
<?php echo $_SERVER['DOCUMENT_ROOT']; ?>

And let me know what it says.
Dave Edis - Senior Developer
interactivetools.com

Re: [Dave] Restricting folder access based on membership level

By gkornbluth - May 11, 2010

Here 'tis.

/hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org/restricted_folder_A/doc_test.php
/hsphere/local/home/apbcweb/artistsofpalmbeachcounty.org

Thanks,

Jerry
The first CMS Builder reference book is now available on-line!







Take advantage of a free 3 month trial subscription, only for CMSB users, at: http://www.thecmsbcookbook.com/trial.php