User - Creating admin interfaces
Admin without the user
plugin
The user
plugin is a proprietary Outlast Framework plugin so the source is not available. If you do not have access to the plugin, you can enable basic admin interface authentication. See an example here.
In general, you can set up standard HTTP authentication dialog
if you need a single user / password and no fancy user administration. Use the protect_me()
method of OFW’s security library.
If you do have purchased a project that includes the user
plugin, use the documentation below.
1. Prepare your project
When you first try to run this on project, you’ll notice that the admin interface is disabled.
First, you’ll need to include the outlast
and user
submodules in your project. Make sure you turn on both plugins in site/index.php
. The user plugin gives you user authentication, while the outlast plugin is optional – it will give you a better UI design.
2. Enable User authentication in each __load()
If you need more advanced user authetication and administration you can use the user
plugin. Once you turn on the user
plugin (see docs), authentication will be enabled by default, but only if you set up your __load()
methods properly.
To enable user authentication for an admin controller, do this:
When you try to visit the admin page for the first time (http://example.com/admin/) you will be taken to the user admin where you should create a new user with full admin privileges (see docs).
3. Create your own admin interfaces
There is an admin template created for the Sample
model which you can use as a starting point for your own model admin interfaces.
View or download the sample here.
To quickly modify the code to your model:
- case-sensitive search/replace for
Sample
toYourModel
- case-sensitive search/replace for
sample
toyourmodel
- rename all files from
sample*
toyourmodel*
- place all files in your project according to the same folder-structure you downloaded it in
Customize default admin page
The user
plugin will send users to http://example.com/admin/user/
by default.
You can change this in user.conf.ini
with the user_admin_default
setting.
As with all config files, do not modify the one in the plugin, but instead create a copy in /plugins/_project/conf/user.conf.ini
. This will override the plugin version so you can change the user_admin_default
to a different page.
Customize authentication
If you want to change the way the authentication works, copy /plugins/user/controller/admin/default.ctl.php
to /app/controller/admin/default.ctl.php
and modify the code as required.
Before you do this, check out the options available in user.conf.ini
because it may be enough just to change the settings here (as described above).