Installing Foodle

A document describing how to install Foodle.

First, install SimpleSAMLphp somewhere, and follow the installation instructions of simpleSAMLphp. In this example, let say you install it in /var/simplesamlphp.

Before continuing, please ensure that the example login page on your simpleSAMLphp installation is working.

1 Preparing the attributes in simpleSAMLphp

You need to setup simpleSAMLphp to translate the attribute names from your IdP to match the one expected by Foodle.

This will diffed depending on which naming scheme that is used by your IdP.

If the IdP is using the MACE oid naming scheme, then proceed as this:

The simpleSAMLphp core module includes a authentication processing filter called AttributeMap, that is used to translate attribute names.

The core module is enabled by default in simpleSAMLphp, and if you run an installation of simpleSAMLphp for the purpose of Foodle only, you may apply the attribute name mapping filter globally. To apply it globally, edit the config.php file.

    'authproc.sp' => array(
        10 => array(
            'class' => 'core:AttributeMap', 'oid-feide'
        ),
        60 => 'smartnameattribute:SmartName',
        // More filters..
    ),

The attribute maps are defined in the attributemap/ directory of simpleSAMLphp, and as you can see there is already a file called oid-feide. This map will translate oid attributes to short names as used by Foodle.

As you can see, I have also enabled a filter called SmartName. If you add this filter in the global config, you must remember to enable the smartnameattribute module. To enable this module, do:

cd modules/smartnameattribute
touch enable

This filter will generate a new attribute named smartname-fullname (if I remember correctly). This is useful because it differ from IdP to IdP what attributes are available, and while at some IdP you can create the fullname by concatenating givenName + sn, at another IdP only cn is available. Take a look at the source code of this module if you are interested in how it works.

After you can setup attribute name translation, visit the SP example login page at the installation page of your installation, and verify that you are logged in with the following attributes:

  • cn
  • givenName
  • sn
  • eduPersonPrincipalName
  • eduPersonTargetedID
  • mail
  • displayName

or at least a sensible subset of them.

2 Install the source code

Check out the source code from google code:

Let's say you install the code in /var/www/foodle. Then you need to set the DocumentRoot on the VHOST in your apache configuration to point at: /var/www/foodle/www.

3 Setting up the database

Foodle is prepared for use with MySQL, but should hopefully work with other databases too without too much tweaking.

  • Create the database, ensure that the access control allow the web server to access it.
  • Initialize the database with the init.sql script.

Database schema:

CREATE TABLE def (
    id varchar(100) NOT NULL PRIMARY KEY,
    name tinytext,
    descr text,
    columns text,

    owner text,
    created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated TIMESTAMP null DEFAULT null,
    expire DATETIME null,
    maxdef text,
    anon tinytext
);

CREATE TABLE entries (
    id int NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    foodleid varchar(100) NOT NULL,
    userid tinytext,
    username tinytext,
    response tinytext,

    created TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
    updated TIMESTAMP null DEFAULT null,

    notes text,
    email text
);

CREATE TABLE discussion (
    id int NOT NULL AUTO_INCREMENT PRIMARY KEY, 
    foodleid varchar(100) NOT NULL,
    username tinytext,
    message text,

    created TIMESTAMP DEFAULT CURRENT_TIMESTAMP
);

4 Creating the configuration file

Go into the config/ directory of Foodle, and copy the config-template.php to config.php.

Then edit the config.php.

  • Add the path to your simpleSAMLphp installation.
  • Add database connection information.