Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
##Requirements
* PHP 5.1.6+, 5.3+ recommended
* CodeIgniter 2.0+
* CodeIgniter Sparks
* MySQL
* ~~php-gmp~~

Expand All @@ -23,11 +24,12 @@
* Groups and Roles: Create groups, and assign users to your groups. Your roles are set on a group, not a user, so changing roles, whether the scale is large or small, is fast and painless.
* Text-based roles: Simply list your roles in the configuration file, then check against them in your code. BitAuth handles everything in between.

##Download
[https://github.com/danmontgomery/codeigniter-bitauth/tarball/v0.2.1](https://github.com/danmontgomery/codeigniter-bitauth/tarball/v0.2.1)

##Installation
Copy the included files to their appropriate locations in the application/ folder. Import bitauth.sql into your database. **If you would like to change the names of the tables BitAuth uses, you can change them in this .sql file, and must also change them in config/bitauth.php**.
php tools/spark install bitauth
Import bitauth.sql into your database. **If you would like to change the names of the tables BitAuth uses, you can change them in this .sql file, and must also change them in config/bitauth.php**.

##Usage
$this->load->spark('bitauth/X.X.X');

##Updating
If updating from v0.1.x, there is a convert() function in the Example controller. This will modify the structure of your groups table, as well as convert any roles you have stored to the new format. This function uses base_convert(), which means results may vary depending on the machine you're running this on. After upgrading, be sure to check the roles in your groups for accuracy.
Expand All @@ -39,4 +41,4 @@ The default login is **admin**/**admin**.

I **highly** recommend you not use the default cookie session... [Try my driver replacement](http://getsparks.org/packages/session-driver/show) for CI's session library (end of shameless self promotion).

Currently, only MySQL is supported. This may change in the future. Or not. We'll see.
Currently, only MySQL is supported. This may change in the future. Or not. We'll see.
3 changes: 3 additions & 0 deletions config/autoload.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<?php if ( ! defined('BASEPATH')) exit('No direct script access allowed');

$autoload['libraries'] = array('bitauth');
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
19 changes: 19 additions & 0 deletions spark.info
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This is the spark-sdk specification. It's in a magical format called YAML.
# Use this format while developing your own sparks!

# This is the spark name. This should be the registered name of the spark.
# It is here for informational purposes only.
name: bitauth

# This is the current version of this spark. All sparks should be in
# x.x.x format. Validation will fail otherwise.
version: 0.2.1

# This is the version of CodeIgniter this spark is compatible up to. It should
# be in x.x.x format
compatibility: 2.0.x

# There are no dependencies now, but when there are, uncomment below.
#dependencies:
# some-spark-1: 1.0.0
# some-other-spark-2: 1.0.0
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 20px 4px; text-align: center; vertical-align: top; }
#table caption { font-size: 1.4em; font-weight: bold; }
</style>
<title>BitAuth: Activation Failed</title>
</head>
<body>
<?php
echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Activation Failed!</caption>';
echo '<tr><td>'.anchor('example', 'Continue').'</td></tr>';
echo '<table>';
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 20px 4px; text-align: center; vertical-align: top; }
#table caption { font-size: 1.4em; font-weight: bold; }
</style>
<title>BitAuth: Activation Failed</title>
</head>
<body>
<?php
echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Activation Failed!</caption>';
echo '<tr><td>'.anchor('example', 'Continue').'</td></tr>';
echo '<table>';
?>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 20px 4px; text-align: center; vertical-align: top; }
#table caption { font-size: 1.4em; font-weight: bold; }
</style>
<title>BitAuth: Activation Successful</title>
</head>
<body>
<?php
echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Activation Successful</caption>';
echo '<tr><td>'.anchor('example', 'Continue').'</td></tr>';
echo '<table>';
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 20px 4px; text-align: center; vertical-align: top; }
#table caption { font-size: 1.4em; font-weight: bold; }
</style>
<title>BitAuth: Activation Successful</title>
</head>
<body>
<?php
echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Activation Successful</caption>';
echo '<tr><td>'.anchor('example', 'Continue').'</td></tr>';
echo '<table>';
?>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,52 +1,51 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 6px; width: 50%; text-align: left; vertical-align: top; }
#table td.label { text-align: right; }
#table caption { font-size: 1.4em; font-weight: bold; }
#table select, #table input[type=text], #table input[type=password], #table textarea { width: 270px; }
.error { color: #940D0A; font-weight: bold; }
</style>
<title>BitAuth: Edit Group</title>
</head>
<body>
<?php
$yesno = array('No','Yes');

echo form_open(current_url());

echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Edit Group</caption>';

if( ! empty($group))
{
echo '<tr><td class="label">Group Name</td><td>'.form_input('name', set_value('name', $group->name)).'</td></tr>';
echo '<tr><td class="label">Description</td><td>'.form_textarea('description', set_value('description', $group->description)).'</td></tr>';
echo '<tr><td class="label">Roles</td><td>'.form_multiselect('roles[]', $roles, set_value('roles[]', $group_roles)).'</td></tr>';
echo '<tr><td class="label">Members</td><td>'.form_multiselect('members[]', $users, set_value('members[]', $group->members)).'</td></tr>';

if(validation_errors())
{
echo '<tr><td colspan="2">'.validation_errors().'</td></tr>';
}

echo '<tr><td class="label" colspan="2">'.anchor('example/groups', 'Cancel').' '.form_submit('submit','Update').'</td></tr>';
} else {
echo '<tr><td><p>Group Not Found</p><p>'.anchor('example/groups', 'Go Back').'</p></td></tr>';
}

echo '</table>';
echo form_close();

echo '<div id="bottom">';
echo anchor('example/logout', 'Logout', 'style="float: right;"');
echo '</div>';

?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 6px; width: 50%; text-align: left; vertical-align: top; }
#table td.label { text-align: right; }
#table caption { font-size: 1.4em; font-weight: bold; }
#table select, #table input[type=text], #table input[type=password], #table textarea { width: 270px; }
.error { color: #940D0A; font-weight: bold; }
</style>
<title>BitAuth: Edit Group</title>
</head>
<body>
<?php
$yesno = array('No','Yes');

echo form_open(current_url());

echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Edit Group</caption>';

if( ! empty($group))
{
echo '<tr><td class="label">Group Name</td><td>'.form_input('name', set_value('name', $group->name)).'</td></tr>';
echo '<tr><td class="label">Description</td><td>'.form_textarea('description', set_value('description', $group->description)).'</td></tr>';
echo '<tr><td class="label">Roles</td><td>'.form_multiselect('roles[]', $roles, set_value('roles[]', $group_roles)).'</td></tr>';
echo '<tr><td class="label">Members</td><td>'.form_multiselect('members[]', $users, set_value('members[]', $group->members)).'</td></tr>';

if(validation_errors())
{
echo '<tr><td colspan="2">'.validation_errors().'</td></tr>';
}

echo '<tr><td class="label" colspan="2">'.anchor('example/groups', 'Cancel').' '.form_submit('submit','Update').'</td></tr>';
} else {
echo '<tr><td><p>Group Not Found</p><p>'.anchor('example/groups', 'Go Back').'</p></td></tr>';
}

echo '</table>';
echo form_close();

echo '<div id="bottom">';
echo anchor('example/logout', 'Logout', 'style="float: right;"');
echo '</div>';

?>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,22 +1,21 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 20px 4px; text-align: center; vertical-align: top; }
#table caption { font-size: 1.4em; font-weight: bold; }
</style>
<title>BitAuth: Access Denied</title>
</head>
<body>
<?php
echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Access Denied</caption>';
echo '<tr><td>Nope.<br/>'.anchor('example', 'Continue').'</td></tr>';
echo '<table>';
?>
</body>
</html>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<style type="text/css">
body { margin: 0; padding: 0; font-size: 10pt; font-family: Verdana, Arial, sans-serif; }
#bottom { width: 600px; padding: 10px; margin: 0 auto; }
#table { width: 600px; margin: 60px auto 0 auto; border-left: 1px solid #666; border-bottom: 1px solid #666; }
#table td, #table th { border: 1px solid #666; border-left: 0; border-bottom: 0; padding: 20px 4px; text-align: center; vertical-align: top; }
#table caption { font-size: 1.4em; font-weight: bold; }
</style>
<title>BitAuth: Access Denied</title>
</head>
<body>
<?php
echo '<table border="0" cellspacing="0" cellpadding="0" id="table">';
echo '<caption>BitAuth Example: Access Denied</caption>';
echo '<tr><td>Nope.<br/>'.anchor('example', 'Continue').'</td></tr>';
echo '<table>';
?>
</body>
</html>
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
Expand Down