Free Trial

Safari Books Online is a digital library providing on-demand subscription access to thousands of learning resources.


  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • DownloadDownload
  • PrintPrint
Share this Page URL
Help

Chapter 7. Advanced Data Access and Disp... > Time for action — setup of our Xataf...

Time for action — setup of our Xataface application

As we mentioned earlier, the default installation of Xataface is not appropriate as a backside portal for Moodle due to the fact that it grants universal and unlimited access to all of the tables in the Moodle database. There are a wealth of tutorials to help assist you customize your Xataface instance on the web in the Wiki area of the Xataface website at www.xataface.com. We will walk through a few of those that are considered to be crucial when using this package together with Moodle. We will start by setting up the authentication feature in Xataface in order to limit access to users who have been granted usernames and passwords. The types of access that can be granted to users will also be listed. To enable the authentication function, follow these steps:

  1. Before we set up authentication in the Xataface application, we need to create a table in the database to store user information. This is a perfect chance for us to use the PHPMyAdmin tool, we installed earlier in this chapter. Navigate to the front page of your site, click on the Server link located in the Site Administration block and then on Database to access the database with PHPMyAdmin.

  2. Click on the database name link found at the top-left of the screen, as shown in the following screenshot. In our test site case, this will be moodle19.

  3. Scroll to the bottom of the main screen (not the table list on the left) and enter the following name in the Name field window under the Create new table on database moodle19 heading: dataface__users. (Note, use two underbars here to include this table in dataface table heading in the table list, as seen in the previous screenshot. Adding this table will result in the number 2 in parenthesis after the dataface table title.)

  4. Enter a 4 for the Number of fields and then click on the Go button. The following screenshot is an example of what you should see prior to clicking on the Go button:

  5. The next window will be a very wide window that will require you to scroll to the right to enter all of the required information. Use the following for the Field names, Type, and Length/Values:

    Field Type Length/Values
    UserID INT 11
    UserName VARCHAR 32
    Password VARCHAR 32
    Role ENUM 'READ ONLY', 'NO ACCESS', 'ADMIN', 'REVIEWER'


  6. Set the Collation to utf8_general_ci for all fields except the UserID.

  7. Set the Role field to NULL but leave the other three NOT NULL.

  8. The Default value for the Role field should be READ ONLY.

  9. Set the UserID to auto_increment using the Extra pull-down menu.

  10. Set the UserID as the Primary key by clicking on the radio button under the key. The UserName should be set to unique and the other two fields can be left untouched. The following screenshot is of these radio button settings:

  11. After having entered and selected all of the desired settings for the table, click on the Save button found on the far right of the screen.

  12. The table will be created and from here you will need to enter one record to be used by the site admin. Click on Insert found at the top of the screen and enter a UserName, Password, and select the ADMIN role from the pull-down menu. The UserID field can be left blank as it will be automatically generated by the database. The following screenshot is an example of how you should fill in the information to create a new record in this table. Click on the Go button to enter the new record into the table.

  13. From the next screen, click on the Browse link found at the top of the window, as shown in the following screenshot, to verify the new record in the table:

  14. The record will appear in the table, as shown in the following screenshot. Next we will go to the Xataface application and activate the authentication feature and point it to this table in the database.

  15. Now let's go to the Xataface application and enable the authentication feature and tell Xataface where to find the user information. Open the conf.ini file found in your Xataface application directory with your text editor. The directory containing the conf.ini file will be CIMS, if you have followed the instructions thus far.

  16. In the conf.ini file, below the [_database] information, enter the following lines and then save the file:

    [_auth]
    users_table = dataface__users
    username_column = UserName
    password_column = Password
    [allowed_tables]
    Users = dataface__users
    
  17. This code activates the authentication plugin and tells Xataface what table the user account information is stored in. Additionally, the Users = dataface__Users record was added under the [allowed_tables] heading because, by default, Xataface disallows all tables that begin with dataface__.

  18. In your CIMS directory, create a new directory titled conf. Using your text editor, create a file inside the conf directory and type in the following code:

    <?php class conf_ApplicationDelegate { function getPermissions(&$record){// $record is a Dataface_Record object $auth =& Dataface_AuthenticationTool::getInstance(); $user =& $auth->getLoggedInUser(); if ( $user ) return Dataface_PermissionsTool::ALL(); else return Dataface_PermissionsTool::NO_ACCESS(); } }
    
    
    					  
  19. Save the file as ApplicationDelegate.php inside the conf directory. This code tells Xataface to require a login of anyone who navigates to the application.

  20. Now access your Xataface application by navigating to /yourmoodlesite/cims/ with your web browser. You will see a login window, as shown in the following screenshot, and notice that while the tables are all still listed, you cannot view the contents of any of them. To log in to the application, use the username and password we entered into the users table earlier: CIMS-Admin and 1234.


  

You are currently reading a PREVIEW of this book.

                                                                                        

Get instant access to over
$1 million worth of books and videos.

  

Start a Free Trial