Loading...
 
Skip to main content

History: Tutorial: How to completely hide your site to non-registered users

Source of version: 12 (current)

Copy to clipboard
            !Background
Often, you want to create a wiki that can only be seen by people who have an account on it. One way to do this of course, is to put the wiki site behind some sort of a firewall. But if it's not an option for you, there are two other ways of doing it.

__Recipe 1: Setting permissions so that anonymous can't do much.__
* This recipe is not as safe as recipe 2, but it avoids an annoying problem with the latter, namely, sometimes with recipe 2, you can't login at all (see below for details).
* The reason why recipe 1 is not as safe is that if you forget to set even one permission correctly, you may introduce a "window" which anonymous users can use to peak at part of your content. For example, if you activate the search module and give anonymous permissions to it, then they will be able to at least find out if a particular keyword produces hits on your site (and see the title and a short exerpt of those hits).

__Recipe 2: "closing" the site for maintenance__
* This is the safest of the two recipes, in that it garantees that anonymous will see nothing more than a simple login form.
* But I have found that with this recipe, there are occasionally problems where you can't login at all, and have to run tiki-instsall.php to restore things back to normal. 
* Also, there seems to be problems with validation of new users, because they can't access the validation URL without logging in, and they can't login before they have validated their account.

The two recipes are described in details below.

!Recipe 1: Setting permissions so that anonymous can't do much.
Here are the steps:
* Log on as a user with admin privileges
* First, make sure all ''Anonymous'' permissions are unchecked
** __Admin > Permissions__
** You see a bunch of links like:
*** blogs
*** calendar
*** cms
*** etc...
** Click on each of those links in turn, and make sure that none of the checkbox in the ''Anonymous'' column are checked.
** Whenever you modify configuration of the site, make sure you never give ''Anonymous'' permission to anything.
* Next, make sure ''Anonymous'' does not have permission to any of the modules, other than the Loginbox and the Logo
** Admin > Modules > Assigned Modules > No Tabs
** If any module is assigned to Anonymous, click on the pen icon on that row, to change the permissions.

Note that self-registration is not possible with this approach, unless you want to allow people to register without email validation (probably not a good idea). The reason is that people cannot access the URL for email validation until they have been validated (chicken and egg kind of thing).

So it's best to disable self-registration and email validation:
* Admin > Login > General Preferences
* Unckeck __Users can register__

From there on, you'll have to manually invite people who should have access to the site:
* Admin > Users
* Add a new yser
* Probably best to check __User must change password at next login.__



!Recipe 2: "closing" the site for maintenance

^__WARNING:__ I have found that with this recipe, there are occasionally problems where you can't login at all! See the section below about __Can't login at all__^.
Here are the steps:
* Log on as a user with admin privileges
* __Admin > Admin Home > Security > Site access tab__
* Check __Close site (except for those with permission)__
* In __Message to display__, Enter a message like: ''"This site is only visible to users with an account. If you need an account, email joe.bloe@somewhere.com"''
* Click on __Save preferences__ button at the bottom of the page.

By default, Admin group has permission __tiki_p_access_closed_site enabled__. But unless you want to give all users on the site Admin privileges (probably not a good idea), you should probably grant 	__tiki_p_access_closed_site__ to a more restricted group of users. 

If your registration procedure is designed in such a way that people can't register without being vetted by an admin, then you can simply set this permission on __Anonymous__. However, if anybody can register without being vetted by an admin, then you probably need to create another group, say, __TrustedUsers__, and grant __tiki_p_access_closed_site__ to that group. 

To grant __tiki_p_access_closed_site__ permission to a group:

* Log on as a user with admin privileges
* __Admin > Admin Home__
* Groups (link at bottom of page)
* In the row for the group you want to give the permsision to, click on the key icon
* In __Find__, __closed__ and hit __Find__ button.
* Check the __tiki_p_access_closed_site item__, then click on the __Update__ button.

From then on, anyone who does not have permission 	__tiki_p_access_closed_site__, will not be able to acess the site, and will only see a login screen. Users who want an account will email the admin whose address is specified in the closed site message. When that admin receives a request from a user, he can create an account for him as follows:
* Log on as a user with admin privileges
* __Admin Home__
* __Users__ link (bottom of page)
*__ Add new user__ tab
* Enter a new user name, generate a password, and enter the email of the person who asked for an account.

!!Can't login at all
For reasons that I don't understand, if you use this recipe, you may occasionally run into trouble where the login screen stops recognizing legal users, and it looks like nobody, including admins, can access the site anymore.

This seems to happen on servers where there are more than one tiki sites running. Also, it seems to happen more frequently (but not exclusively) after upgrades to the tiki software.

But fear not! You can fix this problem by running tiki-install.php, and upgrading the database.

!!Problem validating new users
Another problem which I have occasionally experienced with this recipe is that new users can't validate their account. That's  because they can't access the validation URL they received by email without logging in, and they can't login before they have validated their account.


!See also
* ((Tutorial))

        
Collapse/expand modules below