Gossamer Forum
Home : Products : Gossamer Links : Discussions :

Protect a category......

Quote Reply
Protect a category......
Hi,

Is it possible to protect a special category?

I have a category that I want to use ONLY for registered users!

Thanks,
ron
Quote Reply
Re: [rsahertian] Protect a category...... In reply to
It is possible with the dynamic version of Links using PHP (page.php?do=page) or Perl (cgi-bin/page.cgi?d=1).

Add a column to your Category table (Database > Category (Properties) > Add Column) called something like CatType with the values 'All' and 'Users'

and update your Category.html template by adding these conditions:

<%if CatType eq "Users"%>
<%if Username%>
Display this categories content/links.
<%endif%>
<%ifnot Username%>
You need to <a class="menu_links" href="<%db_cgi_url%>/user.cgi">Login</a> to view this page.
<%endif%>

<%else if CatType eq "All"%>
Display this categories content/links.
<%endif%>



Checking in the post below if its possible to validate users with the static version.

http://gossamer-threads.com/...orum.cgi?post=249562
Quote Reply
Re: [Chas-a] Protect a category...... In reply to
Hi,

this is possible in the dynamic version, but no "username" or "user" info is available in a static version.

Hiding categories has been an issue since the first days. No good solution has been come up with.

Major system hacks can alter the database queries to return only certain data based on logged in status, but because the internals of links are still not all "uniform", and some things are hard coded (as in return routines), it's really not possible to make a plugin or simple utility to do this.

One way, is to create a separate table, that only users have access to. You use page.cgi to check the logged in status ,and add that data to searches. It's a bit of work, but it can happen.

The other thing, is if you only want the categories and such to show up on a search, it's easier to alter the search routines to include or not include certain items.

In a previous version of Links, not 2.12 I did something like this, using isValidated=no (keeping the links unvalidated) but isPreferred=Yes. (my battery is dying, have to go!)

*BUT* I would really wait, and see what the next release of Links SQL will have in it. If they allow a charge module, then it might be part of the functionality to allow or disallow access to certain areas or topics.

At any rate, it will be easier at that time to come up with this sort of solution, since some core logic for handling access will be there.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.
Quote Reply
Re: [pugdog] Protect a category...... In reply to
Hi,

No the payment system is going to be for purchasing listings, not for viewing the database.

If you want to hide the categories, by definition you can't use static html as the content needs to be different depending on whether a user is logged in.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Protect a category...... In reply to
In Reply To:
If you want to hide the categories, by definition you can't use static html as the content needs to be different depending on whether a user is logged in.


Hi Alex,

If a sites using php or serverside includes (in LinksSQL static mode) would this offer the same potential to detect the $username var as using the built in PHP and Perl versions of Links?
Quote Reply
Re: [Chas-a] Protect a category...... In reply to
Hi,

Yes, using either Static + SSI, Dynamic mode, or PHP mode will all allow you to detect if the user is logged in.

Cheers,

Alex
--
Gossamer Threads Inc.
Quote Reply
Re: [Alex] Protect a category...... In reply to
Ok,

If that's not going to affect anything, then maybe this is something I need to add to my ever increasing list of tweaks to release.

Parts of the search system need to be rewritten, and I have not looked deeply into 2.12 to see how it stacks up with older versions. A new flag needs to be passed into each part of the system where it checks for isValidated, and it needs to check a RegisteredOnly field.

ShowRegistered=[yes/no] will be set by the user logged on data.

If a user is registered, the ShowRegistered value will be set to Yes, and you'd go to a search that simply checked isValidated. If the user was not registered, you'd do a search adding "and RegisteredOnly="No" "

Because categories are a different beast, hiding them is a bit more complicated, but might be able to be ignored using templates -- a category that was set to "registered only" if the user was not logged in, the template would display a "This category is for registered users only -- register now" message rather than the category description.

This will effectively hide links at the search level, but requires code modifications. How many depends on the specifics of 2.12. I was able to do this fairly easily on an older version, but don't remember which.

Alex: You might want to think about enabling this sort of feature. We talked about something similar to this over 2 years ago with passing in flags and bitmapping things, to allow added functionality not quite possible with a plugin system. Hidden categories are something people *really* want, and have wanted since way back. Maybe there is a way to do it using the BBS logic of bit masks user-status (like in Gforum). BBS's (the good ones) allowed people to get access to areas on an area by area basis. They could be set to have no acces, view access, read access, download access, etc within each area. They could also be assigned to groups, or more accurately, groups could be assigned to them like Unix permissions, where each group carried with it certain access. The groups were overlayed to give total access, *THEN* the requests were made of the system as to what features were enabled for that user.

I realize it's not a simple thing, but it's really a major evolutionary thing that people have wanted, and it goes along with allowing paid listings -- ie: paid access to areas.

Not everyone uses Links as a links directory. *MOST* seem to be using it for some sort of CMS to varying degrees.

Right now I'm neck deep in getting the ecommerce working, and catalog on-line. My goal is for no later than the end of september for it all to be working. Holiday season starts in October, and I need to be ready. After that, I'll start tying in all the other parts that have been out there for the past year or so.


PUGDOG� Enterprises, Inc.

The best way to contact me is to NOT use Email.
Please leave a PM here.