1
Groover
Permissions for module sub folders?
  • 2004/7/28 22:00

  • Groover

  • Just popping in

  • Posts: 23

  • Since: 2004/7/1 2


Sorry if this has been covered before. I did a search and couldn't find anything.

I have a module called "classes". In my module I have a subfolder called "foo".
The module is only accessible by Admin users.
I created the following two files:

/modules/classes/test.php
-------------------------

require('../../mainfile.php');

echo "foobar
";
?>

/modules/classes/foo/test.php
-----------------------------

require('../../../mainfile.php');

echo "foobar
";
?>

When I log out of my site and access /modules/classes/test.php by tying in the URL directly, I get bounced back to the user.php page. That is what I expected. However, when I access /modules/classes/foo/test.php I see "foobar".

How do I extend the access permissions for a module to all the subfolders in a module?

Thanks for your help!

Groover

2
Groover
Re: Permissions for module sub folders?
  • 2004/7/28 22:11

  • Groover

  • Just popping in

  • Posts: 23

  • Since: 2004/7/1 2


Well, I can make it work if I go into /modules/classes/foo and use:

touch xoops_version.php

but surely there is a better way that doing this in every subfolder (I may end up with dozens of subfolders for this module).

Groover

3
Mithrandir
Re: Permissions for module sub folders?

A XOOPS module is not supposed to have accessed files (files called via an URL) in any other places than modules/modulename and modules/modulename/admin.

4
Groover
Re: Permissions for module sub folders?
  • 2004/7/28 22:45

  • Groover

  • Just popping in

  • Posts: 23

  • Since: 2004/7/1 2


In my classes folder will be subfolders, each containing a class. You have to pay to view the classes. It's not really practical because of the large number of files to put everthing into one folder. I need to protect the perms for these subfolders, because once someone's subscription has ended they might have bookmarked the URL, etc.

Groover

5
Dave_L
Re: Permissions for module sub folders?
  • 2004/7/28 23:51

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Which module is this?

I think the preferred way to approach this is to access the subfolders via the normal module interface, rather than directly by URL. The contents of the classes directory are intended to be files that are included by other files, not accessed directly from a web browser. If the module's permission system is versatile enough, it may be able to handle that.

Alternatively you could use .htaccess files, but then you'd have to handle maintenance of those outside of Xoops.

6
Groover
Re: Permissions for module sub folders?
  • 2004/7/28 23:56

  • Groover

  • Just popping in

  • Posts: 23

  • Since: 2004/7/1 2


Sorry for the confusion. Classes is a custom module I'm writing that provides access to online training classes. Nothing to do with the XOOPS classes folder.

Groover

7
Dave_L
Re: Permissions for module sub folders?
  • 2004/7/29 0:00

  • Dave_L

  • XOOPS is my life!

  • Posts: 2277

  • Since: 2003/11/7


Oops, I should have picked up that "classes" was the name of your module.

If you're writing a custom module, then you should definitely be able to use the XOOPS permission system to control access to the subfolders, as I mentioned above.

8
Groover
Re: Permissions for module sub folders?
  • 2004/7/29 0:47

  • Groover

  • Just popping in

  • Posts: 23

  • Since: 2004/7/1 2


I'm not quite sure I understand. I don't think .htaccess will work because it needs to be tied into the groups. Can you explain your suggestion again for a simpleton like me? Thanks!

Groover

9
jmass
Re: Permissions for module sub folders?
  • 2004/7/29 2:23

  • jmass

  • Friend of XOOPS

  • Posts: 524

  • Since: 2003/12/18


See this thread for setting up group permissions

https://xoops.org/modules/newbb/viewtopic.php?topic_id=12230&forum=4#forumpost99094

I believe this is awhat you should need.

JMass

10
Groover
Re: Permissions for module sub folders?
  • 2004/7/29 16:05

  • Groover

  • Just popping in

  • Posts: 23

  • Since: 2004/7/1 2


Thanks for the suggestion, but I found a simple hack for my problem. I change the following line in /include/common.php:

if (file_exists('./xoops_version.php')) {


to:

if (strpos($xoopsRequestUri"/modules/") === 0) {


and this applies the module permissions to all subfolders.

Thanks again to everyone that replied!

Groover

Login

Who's Online

481 user(s) are online (138 user(s) are browsing Support Forums)


Members: 0


Guests: 481


more...

Donat-O-Meter

Stats
Goal: $100.00
Due Date: Aug 31
Gross Amount: $0.00
Net Balance: $0.00
Left to go: $100.00
Make donations with PayPal!

Latest GitHub Commits