├── .gitignore
├── .gitmodules
├── .travis.yml
├── README.md
├── composer.json
├── composer.lock
├── doc
└── database
│ ├── auth-database.mwb
│ └── auth-database.pdf
├── lib
├── Auth.php
├── api
│ ├── AccountOwner_api.php
│ ├── Account_api.php
│ ├── ActionQueue_api.php
│ ├── Ou_api.php
│ └── UserGroup_api.php
├── misc
│ ├── Database.php
│ ├── PasswordGen.php
│ ├── Provisioning_Email.php
│ ├── ReceiptPrinter.php
│ └── wordlist.txt
├── model
│ ├── AccountOwner_model.php
│ ├── Account_model.php
│ ├── ActionQueue_model.php
│ ├── ListActionType_model.php
│ ├── ListDomain_model.php
│ ├── ListServiceDomain_model.php
│ ├── ListServiceType_model.php
│ ├── Ou_model.php
│ ├── OwnerUserGroup_model.php
│ ├── Service_model.php
│ ├── SubUserGroup_model.php
│ └── UserGroup_model.php
├── service
│ ├── account_service.php
│ ├── ad_service.php
│ ├── gapps_service.php
│ └── ldap_service.php
├── util
│ ├── AccountMerge_util
│ │ ├── AccountMerge_util.php
│ │ ├── README.md
│ │ └── layout
│ │ │ └── main.inc
│ ├── Cleanup_util
│ │ ├── Cleanup_util.php
│ │ ├── README.md
│ │ └── layout
│ │ │ └── main.inc
│ ├── Example_util
│ │ ├── Example_util.php
│ │ ├── README.md
│ │ └── layout
│ │ │ └── main.inc
│ ├── Groupr_util
│ │ ├── Groupr_util.php
│ │ ├── README.md
│ │ └── layout
│ │ │ └── main.inc
│ ├── SasStudent_util
│ │ ├── README.md
│ │ ├── SasStudent_util.php
│ │ └── layout
│ │ │ └── main.inc
│ ├── SimonTeacherYL_util
│ │ ├── README.md
│ │ ├── SimonTeacherYL_util.php
│ │ └── layout
│ │ │ └── main.inc
│ └── util.php
└── web
│ ├── Web.php
│ ├── controller
│ ├── AccountOwner_controller.php
│ ├── Account_controller.php
│ ├── ActionQueue_controller.php
│ ├── Ou_controller.php
│ ├── Page_controller.php
│ ├── UserGroup_controller.php
│ └── Utility_controller.php
│ ├── login
│ ├── form
│ │ ├── account.inc
│ │ ├── assistant.inc
│ │ ├── error.inc
│ │ ├── login.inc
│ │ ├── reset-ok.inc
│ │ └── reset.inc
│ ├── page.inc
│ └── snippet
│ │ └── account_selector.php
│ └── view
│ ├── AccountOwner_view.php
│ ├── Account_view.php
│ ├── ActionQueue_view.php
│ ├── Ou_view.php
│ ├── Page_view.php
│ ├── UserGroup_view.php
│ ├── Utility_view.php
│ └── layout
│ ├── Account
│ ├── create.inc
│ ├── rename.inc
│ └── view.inc
│ ├── AccountOwner
│ ├── addgroup.inc
│ ├── create.inc
│ ├── move.inc
│ ├── pwreset.inc
│ ├── rename.inc
│ └── view.inc
│ ├── ActionQueue
│ ├── log.inc
│ └── view.inc
│ ├── Ou
│ ├── create.inc
│ ├── move.inc
│ ├── rename.inc
│ └── view.inc
│ ├── Page
│ ├── 403.inc
│ ├── 404.inc
│ ├── 500.inc
│ └── home.inc
│ ├── UserGroup
│ ├── addchild.inc
│ ├── addparent.inc
│ ├── adduser.inc
│ ├── create.inc
│ ├── move.inc
│ ├── rename.inc
│ └── view.inc
│ ├── Utility
│ └── home.inc
│ ├── htmlLayout.inc
│ └── snippet
│ ├── account_selector.php
│ └── group_selector.php
├── maintenance
├── bin
│ ├── authqueue-start.sh
│ ├── authqueue.php
│ └── doUtilMaintenance.php
├── demo-install
│ ├── README.md
│ ├── inventory.example
│ ├── inventory.local
│ ├── roles
│ │ ├── common
│ │ │ ├── handlers
│ │ │ │ └── main.yml
│ │ │ └── tasks
│ │ │ │ └── main.yml
│ │ ├── db
│ │ │ ├── handlers
│ │ │ │ └── main.yml
│ │ │ ├── tasks
│ │ │ │ └── main.yml
│ │ │ └── templates
│ │ │ │ └── my.cnf.j2
│ │ ├── ldap
│ │ │ └── tasks
│ │ │ │ └── main.yml
│ │ └── web
│ │ │ ├── handlers
│ │ │ └── main.yml
│ │ │ ├── tasks
│ │ │ └── main.yml
│ │ │ └── templates
│ │ │ ├── .htaccess
│ │ │ ├── auth-web.conf
│ │ │ ├── config.php
│ │ │ └── index.php
│ └── site.yml
├── generate-password.php
├── guest-password-reset.php
├── schema
│ ├── auth.sql
│ ├── create-models.php
│ └── data
│ │ └── defaults.sql
└── test.php
├── site.example
├── bg.jpg
├── config.php
└── logo.png
└── www
└── a
├── account.php
├── admin.php
├── assistant.php
└── public
├── bg.jpg
├── css
├── admin.css
├── blue.css
├── ie-sucks.css
├── iepngfix.htc
├── style.css
├── switch.css
├── theme.css
├── theme2.css
├── theme3.css
├── theme4.css
└── ui-lightness
│ ├── images
│ ├── ui-bg_diagonals-thick_18_b81900_40x40.png
│ ├── ui-bg_diagonals-thick_20_666666_40x40.png
│ ├── ui-bg_flat_10_000000_40x100.png
│ ├── ui-bg_glass_100_f6f6f6_1x400.png
│ ├── ui-bg_glass_100_fdf5ce_1x400.png
│ ├── ui-bg_glass_65_ffffff_1x400.png
│ ├── ui-bg_gloss-wave_35_f6a828_500x100.png
│ ├── ui-bg_highlight-soft_100_eeeeee_1x100.png
│ ├── ui-bg_highlight-soft_75_ffe45c_1x100.png
│ ├── ui-icons_222222_256x240.png
│ ├── ui-icons_228ef1_256x240.png
│ ├── ui-icons_ef8c08_256x240.png
│ ├── ui-icons_ffd27a_256x240.png
│ └── ui-icons_ffffff_256x240.png
│ └── jquery-ui-1.9.1.custom.min.css
├── img
├── bg.jpg
├── bg_blue.jpg
├── bg_brown.jpg
├── bg_light_green.jpg
├── bg_menu_blue.jpg
├── bg_menu_green.jpg
├── bg_menu_mix.jpg
├── bg_menu_red.jpg
├── bg_mix.jpg
├── bootstrap
│ ├── bg.jpg
│ └── kindajean.png
├── delete.png
├── form_blue.gif
├── form_brown.gif
├── form_green.gif
├── form_mix.gif
├── form_red.gif
├── graph.jpg
├── graph2.jpg
└── icons
│ ├── Thumbs.db
│ ├── add.png
│ ├── application_add.png
│ ├── arrow_down.png
│ ├── arrow_down_mini.gif
│ ├── arrow_left.gif
│ ├── arrow_right.gif
│ ├── brick.png
│ ├── brick_edit.png
│ ├── bricks.png
│ ├── bricks_gear.png
│ ├── car.png
│ ├── cart.png
│ ├── cart_add.png
│ ├── cog.png
│ ├── coins.png
│ ├── color_swatch.png
│ ├── expand.jpg
│ ├── feed.png
│ ├── folder.png
│ ├── folder_page.png
│ ├── folder_page_add.png
│ ├── folder_table.png
│ ├── group.png
│ ├── house.png
│ ├── magnifier.png
│ ├── page_add.png
│ ├── page_gear.png
│ ├── page_white_delete.png
│ ├── page_white_edit.png
│ ├── page_white_link.png
│ ├── page_white_text_width.png
│ ├── report.png
│ ├── report_link.png
│ ├── rss.png
│ ├── ui-anim_basic_16x16.gif
│ ├── user.png
│ ├── user_add.png
│ ├── user_delete.png
│ ├── user_edit.png
│ └── world.png
└── js
├── bootstrap
├── css
│ ├── bootstrap-responsive.css
│ ├── bootstrap-responsive.min.css
│ ├── bootstrap.css
│ └── bootstrap.min.css
├── img
│ ├── glyphicons-halflings-white.png
│ └── glyphicons-halflings.png
└── js
│ ├── bootstrap.js
│ └── bootstrap.min.js
├── jquery-1.8.3.min.js
├── jquery-ui-1.9.1.custom.min.js
├── jquery.backstretch.min.js
└── jquery.treeview
├── .gitignore
├── README.md
├── changelog.txt
├── images
├── ajax-loader.gif
├── file.gif
├── folder-closed.gif
├── folder.gif
├── minus.gif
├── plus.gif
├── treeview-black-line.gif
├── treeview-black.gif
├── treeview-default-line.gif
├── treeview-default.gif
├── treeview-famfamfam-line.gif
├── treeview-famfamfam.gif
├── treeview-gray-line.gif
├── treeview-gray.gif
├── treeview-red-line.gif
└── treeview-red.gif
├── jquery.treeview.async.js
├── jquery.treeview.css
├── jquery.treeview.edit.js
├── jquery.treeview.js
├── jquery.treeview.sortable.js
└── todo
/.gitignore:
--------------------------------------------------------------------------------
1 | site/*
2 | .settings/*
3 | .buildpath
4 | *.bak
5 | vendor/
6 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "lib/vendor/google-api-php-client"]
2 | path = lib/vendor/google-api-php-client
3 | url = https://github.com/mike42/google-api-php-client.git
4 | [submodule "lib/vendor/escpos-php"]
5 | path = lib/vendor/escpos-php
6 | url = https://github.com/mike42/escpos-php
7 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | ---
2 | # Use Ubuntu 'trusty' distribution
3 | sudo: required
4 | dist: trusty
5 |
6 | language: php
7 |
8 | php:
9 | - 5.6
10 | - 7.0
11 |
12 | addons:
13 | apt:
14 | sources:
15 | - sourceline: 'ppa:ansible/ansible'
16 | packages:
17 | - ansible
18 |
19 | install:
20 | - composer install
21 |
22 | script:
23 | - (cd maintenance/demo-install && ansible-playbook -i inventory.local site.yml)
24 | ...
25 |
26 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # Auth Web [](https://travis-ci.org/mike42/Auth)
2 |
3 | Auth Web is a system to handle complex user account management setups through a simple web interface.
4 |
5 | The aim of this project is to give every user the impression that they have exactly one user account in the organisation, no matter how complex the underlying infrastructure is. It does this by allowing administrators to link user accounts on different systems that are controlled by the same person, so that the person's access can be managed from one place. Each time an action is performed, Auth Web will interact with the relevant systems asynchronously to bring them up to speed.
6 |
7 | The use cases for this sort of web application include:
8 |
9 | - manage access to systems that don't/can't authenticate centrally
10 | - set a user's password, display name, or group membership on all accounts at once
11 | - set up accounts according to updates to the staff database
12 | - add a web interface so that admins can reset passwords and unlock accounts on the go
13 |
14 | The system ships with plugins for:
15 |
16 | - LDAP (intended for UNIX or RADIUS accounts)
17 | - Microsoft Active Directory
18 | - Google Apps, via the Google Data REST API
19 |
20 | ## Requirements
21 |
22 | This code is intended to run on the following platforms:
23 |
24 | - The most recent stable release of Debian GNU/Linux
25 | - The most recent LTS release of Ubuntu GNU/Linux
26 |
27 | Required software:
28 |
29 | - MySQL or MariaDB server
30 | - Apache webserver
31 | - PHP 5.6, with plugins: php5-ldap php5-cli
32 |
33 | Optional software:
34 |
35 | - phpmyadmin, may be used to perform the database setup through the web
36 | - php5-curl, for the Google Apps service
37 | - php5-odbc and FreeTDS, for plugins which interact with Microsoft SQL Server
38 |
39 | ## Installation
40 |
41 | A standalone example setup is used for testing. Ansible will configure the app and database to manage an empty OpenLDAP domain. For notes on how to install this on a spare Debian-based machine, see the notes under `maintenance/demo-install/README.md`.
42 |
43 | ## Gotchas
44 |
45 | Web Auth does not know your LDAP schema, so by default it uses very basic data structures for groups and users. If you want to take advantage of extra LDAP features, then you should modify `ldap_service.php` to use the features in your schema.
46 |
47 | Auth will attempt to align users' group membership and account locations. If it is asked to synchronise two services that are very different, the results are currently quite messy. Ensure that you have done a trial run against a fake system
48 |
49 | ## Credits
50 |
51 | - The default login background is modified from [this image](http://commons.wikimedia.org/wiki/File:Great_Barrier_Reef_105_%285383117759%29.jpg) on Wikimedia Commons, CC2.
52 | - The Google API [PHP client](https://code.google.com/p/google-api-php-client/) is included, and is under the Apache License.
53 |
--------------------------------------------------------------------------------
/composer.json:
--------------------------------------------------------------------------------
1 | {
2 | "require": {
3 | "mike42/escpos-php": "^1.3"
4 | },
5 | "require-dev": {
6 | "squizlabs/php_codesniffer": "^2.6",
7 | "phpunit/phpunit": "^5.3",
8 | "phpunit/phpunit-selenium": ">=1.2"
9 | },
10 | "autoload": {
11 | "psr-4": {
12 | "Auth\\": "lib"
13 | }
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/doc/database/auth-database.mwb:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mike42/Auth/4a361c248e4400e36955163b629645de37dd056c/doc/database/auth-database.mwb
--------------------------------------------------------------------------------
/doc/database/auth-database.pdf:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/mike42/Auth/4a361c248e4400e36955163b629645de37dd056c/doc/database/auth-database.pdf
--------------------------------------------------------------------------------
/lib/Auth.php:
--------------------------------------------------------------------------------
1 |
6 | */
7 |
8 | namespace Auth;
9 |
10 | use \Exception;
11 |
12 | class Auth {
13 | /**
14 | * Load a class by name
15 | *
16 | * @param string $className The name of the class to load.
17 | */
18 | static public function loadClass($className) {
19 | $sp = explode("_", $className);
20 |
21 | if(count($sp) == 1) {
22 | /* If there are no underscores, it should be in misc */
23 | $sp[0] = self::alphanumeric($sp[0]);
24 | $fn = dirname(__FILE__)."/misc/".$sp[0].".php";
25 | $init = "Auth\\misc\\" . $sp[0];
26 | } else {
27 | /* Otherwise look in the folder suggested by the name */
28 | $folder = self::alphanumeric(array_pop($sp));
29 | $classfile = Auth::alphanumeric($className);
30 | if($folder == "util") {
31 | /* Utilities are self-contained in their own folder */
32 | $fn = dirname(__FILE__)."/$folder/$classfile/$classfile.php";
33 | $init = "Auth\\$folder\\$classfile\\$classfile";
34 | } else {
35 | $fn = dirname(__FILE__)."/$folder/$classfile.php";
36 | $init = "Auth\\$folder\\$classfile";
37 | }
38 | }
39 |
40 | if(!class_exists($init, false)) {
41 | self::loadClassFromFile($fn, $className, $init);
42 | }
43 | }
44 |
45 | /**
46 | * Load a class given its filename, and call FooClass::init()
47 | *
48 | * @param string $fn Filename where we expect to find this class
49 | * @param string $className Name of the class being loaded
50 | * @throws Exception
51 | */
52 | static public function loadClassFromFile($fn, $className, $init) {
53 | if(!file_exists($fn)) {
54 | throw new Exception("The class '$className' could not be found at $fn.");
55 | }
56 |
57 | require_once($fn);
58 |
59 | if(is_callable($init . "::init")) {
60 | call_user_func($init . "::init");
61 | }
62 | }
63 |
64 | /**
65 | * @param unknown_type $classname
66 | * @throws Exception
67 | * @return unknown
68 | */
69 | static public function getConfig($classname) {
70 | include(dirname(__FILE__) . "/../site/config.php");
71 | $classnameParts = explode("\\", $classname);
72 | $section = array_pop($classnameParts);
73 | if(!isset($config[$section])) {
74 | throw new Exception("No configuration found for '$section'");
75 | }
76 | return $config[$section];
77 | }
78 |
79 | /**
80 | * Clear anything other than alphanumeric characters from a string (to prevent arbitrary inclusion)
81 | *
82 | * @param string $inp An input string to be sanitised.
83 | * @return string The input string containing alphanumeric characters only
84 | */
85 | static public function alphanumeric($inp) {
86 | return preg_replace("#[^-a-zA-Z0-9]+#", "_", $inp);
87 | }
88 |
89 | /**
90 | * This function cleans up a string for use in a group/user name, to enforce simple names
91 | *
92 | * @param string $inp
93 | */
94 | static public function normaliseName($inp) {
95 | return strtolower(preg_replace("#[^-a-zA-Z0-9.'_]+#", "", trim($inp)));
96 | }
97 |
98 | /**
99 | * Return true if debugging is enabled, false if not. Some functions log less
100 | * data and remove dangerous features when debugging is off (a good idea for production installs)
101 | */
102 | static public function isDebug() {
103 | $conf = Auth::getConfig("login");
104 | return isset($conf['debug']) && $conf['debug'] == true;
105 | }
106 | }
--------------------------------------------------------------------------------
/lib/misc/Database.php:
--------------------------------------------------------------------------------
1 | fetch(PDO::FETCH_ASSOC);
29 | }
30 |
31 | public static function insert_id() {
32 | return Database::$conn -> lastInsertId();
33 | }
34 |
35 | public static function close() {
36 | /* Close connection */
37 | $this -> conn = null;
38 | return true;
39 | }
40 |
41 | public static function retrieve($query, array $arg) {
42 | return self::doQuery($query, $arg);
43 | }
44 |
45 | public static function insert($query, array $arg) {
46 | $res = self::doQuery($query, $arg);
47 | return self::insert_id();
48 | }
49 |
50 | public static function delete($query, array $arg) {
51 | $res = self::doQuery($query, $arg);
52 | return true;
53 | }
54 |
55 | public static function update($query, array $arg) {
56 | $res = self::doQuery($query, $arg);
57 | return true;
58 | }
59 |
60 | private static function doQuery($query, array $arg) {
61 | if(!self::$conn) {
62 | self::init();
63 | }
64 | /* Query wrapper to be sure everything is escaped. All SQL must go through here! */
65 | $query = str_replace("'%s'", "?", $query);
66 | $stmt = self::$conn -> prepare($query);
67 | $stmt -> execute($arg);
68 | return $stmt;
69 | }
70 |
71 | public static function row_from_template($row, $template) {
72 | /* This copies an associative array from the database, copying only fields which exist in this template */
73 | $res = $template;
74 | foreach($row as $key => $val) {
75 | if(isset($res[$key])) {
76 | $res[$key] = $val;
77 | }
78 | }
79 | return $res;
80 | }
81 | }
82 |
83 | ?>
84 |
--------------------------------------------------------------------------------
/lib/misc/PasswordGen.php:
--------------------------------------------------------------------------------
1 | = 8) {
17 | return $pw;
18 | }
19 | }
20 | }
21 | }
22 |
--------------------------------------------------------------------------------
/lib/misc/Provisioning_Email.php:
--------------------------------------------------------------------------------
1 | address = $address;
16 | $i = strrpos($address, '@');
17 | $this -> local = substr($address, 0, $i);
18 | $i++;
19 | $this -> domain = substr($address, $i, strlen($address) - $i);
20 | }
21 | }
--------------------------------------------------------------------------------
/lib/misc/ReceiptPrinter.php:
--------------------------------------------------------------------------------
1 | setJustification(Escpos::JUSTIFY_CENTER);
25 | if(isset(self::$conf['logo']) && file_exists(self::$conf['logo'])) {
26 | try {
27 | /* Include top image if set & available */
28 | $logofile = self::$conf['logo'];
29 | $ser = $logofile . ".ser";
30 | if(file_exists($ser)) {
31 | $img = unserialize(file_get_contents($ser));
32 | } else {
33 | $img = new EscposImage($logofile);
34 | @file_put_contents($ser, serialize($img)); // Attempt to cache
35 | }
36 | $printer -> bitImage($img);
37 | } catch (Exception $e) {
38 | trigger_error($e -> getMessage());
39 | }
40 | }
41 | $printer -> setEmphasis(true);
42 | $printer -> text(self::$conf['header'] . "\n");
43 | $printer -> setEmphasis(false);
44 | $printer -> feed();
45 | $printer -> text("User Account Information\n");
46 | $printer -> feed(2);
47 | $printer -> setJustification(Escpos::JUSTIFY_LEFT);
48 |
49 | /* User info */
50 | $barcode = "";
51 | $seen = array();
52 | $printer -> text("User Account:\n " . $owner -> owner_firstname . " " . $owner -> owner_surname . "\n\n");
53 | $printer -> text("Login name(s):\n");
54 | foreach($owner -> list_Account as $acct) {
55 | if(!isset($seen[$acct -> account_login])) {
56 | $printer -> text(" " . $acct -> account_login . "\n");
57 | $seen[$acct -> account_login] = true;
58 | if(is_numeric($acct -> account_login) && ($barcode == "" || strlen($acct -> account_login) < strlen($barcode))) {
59 | $barcode = $acct -> account_login;
60 | }
61 | }
62 | }
63 | $printer -> feed();
64 | $printer -> text("Password:\n $password\n");
65 | $printer -> feed(2);
66 |
67 | /* Footer */
68 | $printer -> text(self::$conf['footer'] . "\n");
69 | $printer -> feed();
70 |
71 | /* Barcode */
72 | if($barcode != "") {
73 | $printer -> setJustification(Escpos::JUSTIFY_CENTER);
74 | $printer -> barcode($barcode, Escpos::BARCODE_CODE39);
75 | $printer -> feed();
76 | $printer -> text($barcode);
77 | $printer -> feed(1);
78 | $printer -> setJustification(Escpos::JUSTIFY_LEFT);
79 | }
80 | $printer -> cut();
81 | $printer -> close();
82 | } catch(Exception $e) {
83 | trigger_error($e -> getMessage()); // Should be logged some-place for troubleshooting.
84 | return false;
85 | }
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/lib/model/AccountOwner_model.php:
--------------------------------------------------------------------------------
1 | owner_id = isset($row['owner_id']) ? $row['owner_id'] : '';
41 | $this -> owner_firstname = isset($row['owner_firstname']) ? $row['owner_firstname']: '';
42 | $this -> owner_surname = isset($row['owner_surname']) ? $row['owner_surname'] : '';
43 | $this -> ou_id = isset($row['ou_id']) ? $row['ou_id'] : '';
44 |
45 | /* Fields from related tables */
46 | $this -> Ou = new Ou_model($row);
47 | }
48 |
49 | public static function get($owner_id) {
50 | $sql = "SELECT * FROM AccountOwner LEFT JOIN Ou ON AccountOwner.ou_id = Ou.ou_id WHERE AccountOwner.owner_id='%s'";
51 | $res = Database::retrieve($sql, array($owner_id));
52 | if($row = Database::get_row($res)) {
53 | return new AccountOwner_model($row);
54 | }
55 | return false;
56 | }
57 |
58 | public static function list_by_ou_id($ou_id) {
59 | $sql = "SELECT * FROM AccountOwner LEFT JOIN Ou ON AccountOwner.ou_id = Ou.ou_id WHERE AccountOwner.ou_id='%s' ORDER BY owner_surname, owner_firstname, owner_id;";
60 | $res = Database::retrieve($sql, array($ou_id));
61 | $ret = array();
62 | while($row = Database::get_row($res)) {
63 | $ret[] = new AccountOwner_model($row);
64 | }
65 | return $ret;
66 | }
67 |
68 | public function populate_list_Account() {
69 | $this -> list_Account = Account_model::list_by_owner_id($this -> owner_id);
70 | }
71 |
72 | public function populate_list_OwnerUserGroup() {
73 | $this -> list_OwnerUserGroup = OwnerUserGroup_model::list_by_owner_id($this -> owner_id);
74 | }
75 |
76 | public function insert() {
77 | $sql = "INSERT INTO AccountOwner(owner_firstname, owner_surname, ou_id) VALUES ('%s', '%s', '%s');";
78 | return Database::insert($sql, array($this -> owner_firstname, $this -> owner_surname, $this -> ou_id));
79 | }
80 |
81 | public function update() {
82 | $sql = "UPDATE AccountOwner SET owner_firstname ='%s', owner_surname ='%s', ou_id ='%s' WHERE owner_id ='%s';";
83 | return Database::update($sql, array($this -> owner_firstname, $this -> owner_surname, $this -> ou_id, $this -> owner_id));
84 | }
85 |
86 | public function delete() {
87 | $sql = "DELETE FROM AccountOwner WHERE owner_id ='%s';";
88 | return Database::delete($sql, array($this -> owner_id));
89 | }
90 | }
91 | ?>
--------------------------------------------------------------------------------
/lib/model/ListActionType_model.php:
--------------------------------------------------------------------------------
1 | action_type = isset($row['action_type']) ? $row['action_type']: '';
30 | }
31 |
32 | public static function get($action_type) {
33 | $sql = "SELECT * FROM ListActionType WHERE ListActionType.action_type='%s'";
34 | $res = Database::retrieve($sql, array($action_type));
35 | if($row = Database::get_row($res)) {
36 | return new ListActionType_model($row);
37 | }
38 | return false;
39 | }
40 |
41 | public function populate_list_ActionQueue() {
42 | $this -> list_ActionQueue = ActionQueue_model::list_by_action_type($this -> action_type);
43 | }
44 |
45 | public function insert() {
46 | $sql = "INSERT INTO ListActionType(action_type) VALUES ('%s');";
47 | return Database::insert($sql, array($this -> action_type));
48 | }
49 |
50 | public function update() {
51 | $sql = "UPDATE ListActionType SET WHERE action_type ='%s';";
52 | return Database::update($sql, array($this -> action_type));
53 | }
54 |
55 | public function delete() {
56 | $sql = "DELETE FROM ListActionType WHERE action_type ='%s';";
57 | return Database::delete($sql, array($this -> action_type));
58 | }
59 | }
60 | ?>
--------------------------------------------------------------------------------
/lib/model/ListDomain_model.php:
--------------------------------------------------------------------------------
1 | domain_id = isset($row['domain_id']) ? $row['domain_id'] : '';
44 | $this -> domain_name = isset($row['domain_name']) ? $row['domain_name'] : '';
45 | $this -> domain_enabled = isset($row['domain_enabled']) ? $row['domain_enabled']: '';
46 | }
47 |
48 | public static function get($domain_id) {
49 | $sql = "SELECT * FROM ListDomain WHERE ListDomain.domain_id='%s'";
50 | $res = Database::retrieve($sql, array($domain_id));
51 | if($row = Database::get_row($res)) {
52 | return new ListDomain_model($row);
53 | }
54 | return false;
55 | }
56 |
57 | public static function list_by_domain_enabled($domain_enabled) {
58 | $sql = "SELECT * FROM ListDomain WHERE ListDomain.domain_enabled='%s';";
59 | $res = Database::retrieve($sql, array($domain_enabled));
60 | $ret = array();
61 | while($row = Database::get_row($res)) {
62 | $ret[] = new ListDomain_model($row);
63 | }
64 | return $ret;
65 | }
66 |
67 | public function populate_list_Account() {
68 | $this -> list_Account = Account_model::list_by_account_domain($this -> domain_id);
69 | }
70 |
71 | public function populate_list_ActionQueue() {
72 | $this -> list_ActionQueue = ActionQueue_model::list_by_domain_id($this -> domain_id);
73 | }
74 |
75 | public function populate_list_ListServiceDomain() {
76 | $this -> list_ListServiceDomain = ListServiceDomain_model::list_by_domain_id($this -> domain_id);
77 | }
78 |
79 | public function populate_list_Service() {
80 | $this -> list_Service = Service_model::list_by_service_domain($this -> domain_id);
81 | }
82 |
83 | public function populate_list_UserGroup() {
84 | $this -> list_UserGroup = UserGroup_model::list_by_group_domain($this -> domain_id);
85 | }
86 |
87 | public function insert() {
88 | $sql = "INSERT INTO ListDomain(domain_id, domain_name, domain_enabled) VALUES ('%s', '%s', '%s');";
89 | return Database::insert($sql, array($this -> domain_id, $this -> domain_name, $this -> domain_enabled));
90 | }
91 |
92 | public function update() {
93 | $sql = "UPDATE ListDomain SET domain_name ='%s', domain_enabled ='%s' WHERE domain_id ='%s';";
94 | return Database::update($sql, array($this -> domain_name, $this -> domain_enabled, $this -> domain_id));
95 | }
96 |
97 | public function delete() {
98 | $sql = "DELETE FROM ListDomain WHERE domain_id ='%s';";
99 | return Database::delete($sql, array($this -> domain_id));
100 | }
101 | }
102 | ?>
--------------------------------------------------------------------------------
/lib/model/ListServiceDomain_model.php:
--------------------------------------------------------------------------------
1 | service_id = isset($row['service_id']) ? $row['service_id'] : '';
36 | $this -> domain_id = isset($row['domain_id']) ? $row['domain_id'] : '';
37 | $this -> sd_root = isset($row['sd_root']) ? $row['sd_root'] : '';
38 | $this -> sd_secondary = isset($row['sd_secondary']) ? $row['sd_secondary']: '';
39 |
40 | /* Fields from related tables */
41 | $this -> Service = new Service_model($row);
42 | $this -> ListDomain = new ListDomain_model($row);
43 | }
44 |
45 | public static function get($service_id, $domain_id) {
46 | $sql = "SELECT * FROM ListServiceDomain LEFT JOIN Service ON ListServiceDomain.service_id = Service.service_id LEFT JOIN ListDomain ON ListServiceDomain.domain_id = ListDomain.domain_id LEFT JOIN ListServiceType ON Service.service_type = ListServiceType.service_type WHERE ListServiceDomain.service_id='%s' AND ListServiceDomain.domain_id='%s'";
47 | $res = Database::retrieve($sql, array($service_id, $domain_id));
48 | if($row = Database::get_row($res)) {
49 | return new ListServiceDomain_model($row);
50 | }
51 | return false;
52 | }
53 |
54 | public static function list_by_domain_id($domain_id) {
55 | $sql = "SELECT * FROM ListServiceDomain LEFT JOIN Service ON ListServiceDomain.service_id = Service.service_id LEFT JOIN ListDomain ON ListServiceDomain.domain_id = ListDomain.domain_id LEFT JOIN ListServiceType ON Service.service_type = ListServiceType.service_type WHERE ListServiceDomain.domain_id='%s';";
56 | $res = Database::retrieve($sql, array($domain_id));
57 | $ret = array();
58 | while($row = Database::get_row($res)) {
59 | $ret[] = new ListServiceDomain_model($row);
60 | }
61 | return $ret;
62 | }
63 |
64 | public static function list_by_service_id($service_id) {
65 | $sql = "SELECT * FROM ListServiceDomain LEFT JOIN Service ON ListServiceDomain.service_id = Service.service_id LEFT JOIN ListDomain ON ListServiceDomain.domain_id = ListDomain.domain_id LEFT JOIN ListServiceType ON Service.service_type = ListServiceType.service_type WHERE ListServiceDomain.service_id='%s';";
66 | $res = Database::retrieve($sql, array($service_id));
67 | $ret = array();
68 | while($row = Database::get_row($res)) {
69 | $ret[] = new ListServiceDomain_model($row);
70 | }
71 | return $ret;
72 | }
73 |
74 | public function insert() {
75 | $sql = "INSERT INTO ListServiceDomain(service_id, domain_id, sd_root, sd_secondary) VALUES ('%s', '%s', '%s', '%s');";
76 | return Database::insert($sql, array($this -> service_id, $this -> domain_id, $this -> sd_root, $this -> sd_secondary));
77 | }
78 |
79 | public function update() {
80 | $sql = "UPDATE ListServiceDomain SET sd_root ='%s', sd_secondary ='%s' WHERE service_id ='%s' AND domain_id ='%s';";
81 | return Database::update($sql, array($this -> sd_root, $this -> sd_secondary, $this -> service_id, $this -> domain_id));
82 | }
83 |
84 | public function delete() {
85 | $sql = "DELETE FROM ListServiceDomain WHERE service_id ='%s' AND domain_id ='%s';";
86 | return Database::delete($sql, array($this -> service_id, $this -> domain_id));
87 | }
88 | }
89 | ?>
--------------------------------------------------------------------------------
/lib/model/ListServiceType_model.php:
--------------------------------------------------------------------------------
1 | service_type = isset($row['service_type']) ? $row['service_type']: '';
30 | }
31 |
32 | public static function get($service_type) {
33 | $sql = "SELECT * FROM ListServiceType WHERE ListServiceType.service_type='%s'";
34 | $res = Database::retrieve($sql, array($service_type));
35 | if($row = Database::get_row($res)) {
36 | return new ListServiceType_model($row);
37 | }
38 | return false;
39 | }
40 |
41 | public function populate_list_Service() {
42 | $this -> list_Service = Service_model::list_by_service_type($this -> service_type);
43 | }
44 |
45 | public function insert() {
46 | $sql = "INSERT INTO ListServiceType(service_type) VALUES ('%s');";
47 | return Database::insert($sql, array($this -> service_type));
48 | }
49 |
50 | public function update() {
51 | $sql = "UPDATE ListServiceType SET WHERE service_type ='%s';";
52 | return Database::update($sql, array($this -> service_type));
53 | }
54 |
55 | public function delete() {
56 | $sql = "DELETE FROM ListServiceType WHERE service_type ='%s';";
57 | return Database::delete($sql, array($this -> service_type));
58 | }
59 | }
60 | ?>
--------------------------------------------------------------------------------
/lib/model/Ou_model.php:
--------------------------------------------------------------------------------
1 | ou_id = isset($row['ou_id']) ? $row['ou_id'] : '';
40 | $this -> ou_parent_id = isset($row['ou_parent_id']) ? $row['ou_parent_id']: '';
41 | $this -> ou_name = isset($row['ou_name']) ? $row['ou_name'] : '';
42 | /* Fields from related tables */
43 | /* Self-reference excluded to prevent an infinite loop */
44 | // $this -> Ou = new Ou_model($row);
45 | }
46 |
47 | public static function get($ou_id) {
48 | $sql = "SELECT * FROM Ou WHERE Ou.ou_id='%s'";
49 | $res = Database::retrieve($sql, array($ou_id));
50 | if($row = Database::get_row($res)) {
51 | return new Ou_model($row);
52 | }
53 | return false;
54 | }
55 |
56 | public static function get_by_ou_name($ou_name) {
57 | $sql = "SELECT * FROM Ou WHERE Ou.ou_name='%s'";
58 | $res = Database::retrieve($sql, array($ou_name));
59 | if($row = Database::get_row($res)) {
60 | return new Ou_model($row);
61 | }
62 | return false;
63 | }
64 |
65 | public static function list_by_ou_parent_id($ou_parent_id) {
66 | $sql = "SELECT * FROM Ou WHERE Ou.ou_parent_id='%s';";
67 | $res = Database::retrieve($sql, array($ou_parent_id));
68 | $ret = array();
69 | while($row = Database::get_row($res)) {
70 | $ret[] = new Ou_model($row);
71 | }
72 | return $ret;
73 | }
74 |
75 | public function populate_list_AccountOwner() {
76 | $this -> list_AccountOwner = AccountOwner_model::list_by_ou_id($this -> ou_id);
77 | }
78 |
79 | public function populate_list_Ou() {
80 | $this -> list_Ou = Ou_model::list_by_ou_parent_id($this -> ou_id);
81 | }
82 |
83 | public function populate_list_UserGroup() {
84 | $this -> list_UserGroup = UserGroup_model::list_by_ou_id($this -> ou_id);
85 | }
86 |
87 | public function insert() {
88 | $sql = "INSERT INTO Ou(ou_parent_id, ou_name) VALUES ('%s', '%s');";
89 | return Database::insert($sql, array($this -> ou_parent_id, $this -> ou_name));
90 | }
91 |
92 | public function update() {
93 | $sql = "UPDATE Ou SET ou_parent_id ='%s', ou_name ='%s' WHERE ou_id ='%s';";
94 | return Database::update($sql, array($this -> ou_parent_id, $this -> ou_name, $this -> ou_id));
95 | }
96 |
97 | public function delete() {
98 | $sql = "DELETE FROM Ou WHERE ou_id ='%s';";
99 | return Database::delete($sql, array($this -> ou_id));
100 | }
101 | }
102 | ?>
--------------------------------------------------------------------------------
/lib/model/OwnerUserGroup_model.php:
--------------------------------------------------------------------------------
1 | owner_id = isset($row['owner_id']) ? $row['owner_id']: '';
34 | $this -> group_id = isset($row['group_id']) ? $row['group_id']: '';
35 |
36 | /* Fields from related tables */
37 | $this -> AccountOwner = new AccountOwner_model($row);
38 | $this -> UserGroup = new UserGroup_model($row);
39 | }
40 |
41 | public static function get($owner_id, $group_id) {
42 | $sql = "SELECT * FROM OwnerUserGroup LEFT JOIN AccountOwner ON OwnerUserGroup.owner_id = AccountOwner.owner_id LEFT JOIN UserGroup ON OwnerUserGroup.group_id = UserGroup.group_id LEFT JOIN Ou ON AccountOwner.ou_id = Ou.ou_id LEFT JOIN ListDomain ON UserGroup.group_domain = ListDomain.domain_id WHERE OwnerUserGroup.owner_id='%s' AND OwnerUserGroup.group_id='%s'";
43 | $res = Database::retrieve($sql, array($owner_id, $group_id));
44 | if($row = Database::get_row($res)) {
45 | return new OwnerUserGroup_model($row);
46 | }
47 | return false;
48 | }
49 |
50 | public static function list_by_owner_id($owner_id) {
51 | $sql = "SELECT * FROM OwnerUserGroup LEFT JOIN AccountOwner ON OwnerUserGroup.owner_id = AccountOwner.owner_id LEFT JOIN UserGroup ON OwnerUserGroup.group_id = UserGroup.group_id LEFT JOIN Ou ON AccountOwner.ou_id = Ou.ou_id LEFT JOIN ListDomain ON UserGroup.group_domain = ListDomain.domain_id WHERE OwnerUserGroup.owner_id='%s' ORDER BY UserGroup.group_name, UserGroup.group_id;";
52 | $res = Database::retrieve($sql, array($owner_id));
53 | $ret = array();
54 | while($row = Database::get_row($res)) {
55 | $ret[] = new OwnerUserGroup_model($row);
56 | }
57 | return $ret;
58 | }
59 |
60 | public static function list_by_group_id($group_id) {
61 | $sql = "SELECT * FROM OwnerUserGroup LEFT JOIN AccountOwner ON OwnerUserGroup.owner_id = AccountOwner.owner_id LEFT JOIN UserGroup ON OwnerUserGroup.group_id = UserGroup.group_id LEFT JOIN Ou ON AccountOwner.ou_id = Ou.ou_id LEFT JOIN ListDomain ON UserGroup.group_domain = ListDomain.domain_id WHERE OwnerUserGroup.group_id='%s' ORDER BY AccountOwner.owner_surname, AccountOwner.owner_firstname, AccountOwner.owner_id;";
62 | $res = Database::retrieve($sql, array($group_id));
63 | $ret = array();
64 | while($row = Database::get_row($res)) {
65 | $ret[] = new OwnerUserGroup_model($row);
66 | }
67 | return $ret;
68 | }
69 |
70 | public function insert() {
71 | $sql = "INSERT INTO OwnerUserGroup(owner_id, group_id) VALUES ('%s', '%s');";
72 | return Database::insert($sql, array($this -> owner_id, $this -> group_id));
73 | }
74 |
75 | public function update() {
76 | $sql = "UPDATE OwnerUserGroup SET WHERE owner_id ='%s' AND group_id ='%s';";
77 | return Database::update($sql, array($this -> owner_id, $this -> group_id));
78 | }
79 |
80 | public function delete() {
81 | $sql = "DELETE FROM OwnerUserGroup WHERE owner_id ='%s' AND group_id ='%s';";
82 | return Database::delete($sql, array($this -> owner_id, $this -> group_id));
83 | }
84 | }
85 | ?>
--------------------------------------------------------------------------------
/lib/model/SubUserGroup_model.php:
--------------------------------------------------------------------------------
1 | parent_group_id = isset($row['parent_group_id']) ? $row['parent_group_id']: '';
31 | $this -> group_id = isset($row['group_id']) ? $row['group_id'] : '';
32 |
33 | /* Fields from related tables */
34 | $this -> UserGroup = new UserGroup_model($row);
35 | }
36 |
37 | public static function get($parent_group_id, $group_id) {
38 | $sql = "SELECT * FROM SubUserGroup LEFT JOIN UserGroup ON SubUserGroup.group_id = UserGroup.group_id LEFT JOIN Ou ON UserGroup.ou_id = Ou.ou_id LEFT JOIN ListDomain ON UserGroup.group_domain = ListDomain.domain_id WHERE SubUserGroup.parent_group_id='%s' AND SubUserGroup.group_id='%s'";
39 | $res = Database::retrieve($sql, array($parent_group_id, $group_id));
40 | if($row = Database::get_row($res)) {
41 | return new SubUserGroup_model($row);
42 | }
43 | return false;
44 | }
45 |
46 | public static function list_by_parent_group_id($parent_group_id) {
47 | $sql = "SELECT * FROM SubUserGroup LEFT JOIN UserGroup ON SubUserGroup.group_id = UserGroup.group_id LEFT JOIN Ou ON UserGroup.ou_id = Ou.ou_id LEFT JOIN ListDomain ON UserGroup.group_domain = ListDomain.domain_id WHERE SubUserGroup.parent_group_id='%s' ORDER BY UserGroup.group_name, UserGroup.group_id;";
48 | $res = Database::retrieve($sql, array($parent_group_id));
49 | $ret = array();
50 | while($row = Database::get_row($res)) {
51 | $ret[] = new SubUserGroup_model($row);
52 | }
53 | return $ret;
54 | }
55 |
56 | public static function list_by_group_id($group_id) {
57 | $sql = "SELECT * FROM SubUserGroup LEFT JOIN UserGroup ON SubUserGroup.group_id = UserGroup.group_id LEFT JOIN Ou ON UserGroup.ou_id = Ou.ou_id LEFT JOIN ListDomain ON UserGroup.group_domain = ListDomain.domain_id WHERE SubUserGroup.group_id='%s' ORDER BY UserGroup.group_name, UserGroup.group_id;";
58 | $res = Database::retrieve($sql, array($group_id));
59 | $ret = array();
60 | while($row = Database::get_row($res)) {
61 | $ret[] = new SubUserGroup_model($row);
62 | }
63 | return $ret;
64 | }
65 |
66 | public function insert() {
67 | $sql = "INSERT INTO SubUserGroup(parent_group_id, group_id) VALUES ('%s', '%s');";
68 | return Database::insert($sql, array($this -> parent_group_id, $this -> group_id));
69 | }
70 |
71 | public function update() {
72 | $sql = "UPDATE SubUserGroup SET WHERE parent_group_id ='%s' AND group_id ='%s';";
73 | return Database::update($sql, array($this -> parent_group_id, $this -> group_id));
74 | }
75 |
76 | public function delete() {
77 | $sql = "DELETE FROM SubUserGroup WHERE parent_group_id ='%s' AND group_id ='%s';";
78 | return Database::delete($sql, array($this -> parent_group_id, $this -> group_id));
79 | }
80 | }
81 | ?>
--------------------------------------------------------------------------------
/lib/util/AccountMerge_util/README.md:
--------------------------------------------------------------------------------
1 | AccountMerge
2 | =========================
3 |
4 | This utility assists with merging account-lists from two owners who are the same person.
5 |
6 |
7 | Installation
8 | ------------
9 |
10 | Enable the utility by adding an entry to the Util list in config.php:
11 |
12 | 'AccountMerge' => 'Account Merge Tool'
13 |
--------------------------------------------------------------------------------
/lib/util/AccountMerge_util/layout/main.inc:
--------------------------------------------------------------------------------
1 |
4 |
5 |
16 |
17 |
18 |
19 |
20 |
21 |
22 | What is account merging?
23 |
24 |
If a user has multiple existing accounts (on different services),
25 | then you probably want them to appear on the same page on Auth.
26 | This means that you can reset the login details, account
27 | information, and group membership details in one place.
28 |
This utility exists to help you merge together multiple
29 | AccountOwner pages. To do this, they must not contain accounts on
30 | the same service!
31 |
32 |
33 |
34 |
35 |
Account Merge Utility
36 |
37 | ".web::escapeHTML($data['message']) . "
";
40 | }
41 | ?>
42 |
43 |
Select Accounts to Merge
44 |
45 | "?>
46 |
47 |
Accounts can only be merged if they are in the same Organization
48 | Unit, in no groups at all, and have the same name. The form below
49 | will help you find the accounts, and the 'Prepare' button will make
50 | these changes.
51 |
After the Queue has emptied, you can then merge the accounts
52 | together, and add the new AccountOwner back to the correct User
53 | Groups!
54 |
55 |
56 |
57 |
Select new:
58 |
60 |
61 |
62 |
63 |
64 |
Selected:
65 |
".web::escapeHTML($data['owners']).""; ?>
66 |
67 |
68 |
69 |
70 |
72 |
73 |
74 |
75 |
76 |
77 | "; ?>
78 |
79 |
80 |
81 |
82 |
--------------------------------------------------------------------------------
/lib/util/Cleanup_util/README.md:
--------------------------------------------------------------------------------
1 | Directory Cleanup Utility
2 | =========================
3 |
4 | This utility facilitates a few simple cleanup operations which admins might want to run from time-to-time.
5 |
6 | Installation
7 | ------------
8 | Enable the utility by adding an entry to the Util list in config.php:
9 |
10 | 'Cleanup' => 'Directory Cleanup Tools'
11 |
--------------------------------------------------------------------------------
/lib/util/Example_util/Example_util.php:
--------------------------------------------------------------------------------
1 | "Utility", "util" => self::$util_name, "template" => "main");
35 |
36 | // Find data to display
37 | if(isset($_POST['helloworld'])) {
38 | $data['message'] = "Hello World";
39 | }
40 |
41 | return $data;
42 | }
43 |
44 | /**
45 | * Do any maintenance tasks
46 | */
47 | public static function doMaintenance() {
48 |
49 | // Do tasks here
50 | throw new Exception("Unimplemented");
51 | }
52 | }
--------------------------------------------------------------------------------
/lib/util/Example_util/README.md:
--------------------------------------------------------------------------------
1 | Example Utility
2 | =========================
3 |
4 | This is a simple example for writing plugins (known as 'utilities') for the Auth
5 | system. Plugins are used to implement organisation-specific logic, features not
6 | directly supported, or interfaces to strange and wonderful external databases
7 | that might dictate user accounts or groups.
8 |
9 | Normally, this section would include some information about the utility, and why
10 | you might (or might not) want to use it.
11 |
12 | Installation
13 | ------------
14 |
15 | Enable the utility by adding an entry to the Util list in config.php:
16 |
17 | 'Example' => 'Example Utility'
18 |
--------------------------------------------------------------------------------
/lib/util/Example_util/layout/main.inc:
--------------------------------------------------------------------------------
1 |
4 |
5 |
6 |
7 |
8 |
9 | What does this do?
10 |
11 |
A brief description of the utility and its purpose. You may wish
12 | to use a definition list if there is special jargon involved:
13 |
14 |
Feature
15 |
Description
16 |
Feature
17 |
Description
18 |
19 |
20 |
21 |
22 |
23 |
Example Utility
24 |
25 | ".web::escapeHTML($data['message']) . "
";
28 | }
29 | ?>
30 |
31 |
Feature
32 |
33 | "?>
34 |
35 |
The "Hello World" feature says hello to the world
36 |
37 | "; ?>
38 |
39 |
40 |
41 |
42 |
43 |
--------------------------------------------------------------------------------
/lib/util/Groupr_util/Groupr_util.php:
--------------------------------------------------------------------------------
1 | "Utility", "util" => self::$util_name, "template" => "main");
37 | $service_id = self::$config['service_id'];
38 | $service = Service_model::get($service_id);
39 | if(!$service) {
40 | throw new Exception("Service '$service_id' does not exist.");
41 | }
42 |
43 | if(isset($_POST['group_cn']) && isset($_POST['gname'])) {
44 | Auth::loadClass("PasswordGen");
45 | $group_cn = trim($_POST['group_cn']);
46 | if($group_cn == "") {
47 | $group_cn = trim($_POST['gname']);
48 | }
49 | if(!$group = UserGroup_model::get_by_group_cn($group_cn)) {
50 | $data['message'] = "Group $group_cn does not exist!";
51 | return $data;
52 | }
53 | $group -> populate_list_OwnerUserGroup();
54 | if(count($group -> list_OwnerUserGroup) == 0) {
55 | $data['message'] = "Group '$group_cn' has no direct members.";
56 | }
57 |
58 | $print = isset($_POST['print']);
59 | $good = $fail = 0;
60 | foreach($group -> list_OwnerUserGroup as $oug) {
61 | $preset = passwordGen::Generate();
62 | $account = Account_model::get_by_service_owner_unique($service_id, $oug -> owner_id);
63 | if ($account){
64 | AccountOwner_api::pwreset($oug -> AccountOwner -> owner_id, $preset, $print);
65 | $passwrd [$account -> account_login] = $preset;
66 | $good++;
67 | } else {
68 | $fail++;
69 | }
70 |
71 | }
72 | $data['message'] = "Of " . count($group -> list_OwnerUserGroup) . " users in $group_cn, $good have been reset, $fail had no account in $service_id.";
73 | $data['passwrd'] = $passwrd;
74 | }
75 |
76 | return $data;
77 | }
78 |
79 | /**
80 | * Do any maintenance tasks
81 | */
82 | public static function doMaintenance() {
83 |
84 | // Do tasks here
85 | throw new Exception("Unimplemented");
86 | }
87 | }
88 |
--------------------------------------------------------------------------------
/lib/util/Groupr_util/README.md:
--------------------------------------------------------------------------------
1 | Group Reset Utility
2 | ==================
3 | This utility is for the batch resetting of user passwords. It resets the passwords of every member of a group and outputs the user name and password in an excel/csv compatible format for copying.
4 |
5 | The reset will ONLY reset the accounts of the members in the main group as defined and not those of any subgroups.
6 |
7 |
8 | Installation
9 | ------------
10 |
11 | To enable the utility add an entry to the Util list in config.php:
12 |
13 | 'Util' =>
14 | array(
15 | // List of other utilities ...
16 | 'Groupr' => 'GroupReset'
17 | )
18 |
19 | And finally, add all of the configuration options that the utility will be using:
20 |
21 | 'Groupr' =>
22 | array( 'service_id' => 'ldap')
23 |
24 | This ensures that only users who have accounts on this service can have their passwords reset using this utility.
25 |
--------------------------------------------------------------------------------
/lib/util/Groupr_util/layout/main.inc:
--------------------------------------------------------------------------------
1 |
4 |
6 |
7 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | What does this do?
25 |
26 |
This utility is for batch resetting passwords for an entire group. Each member has their password reset and output in an excel/csv compatible format.
27 |
28 | This utility only resets the passwords of the direct members of the defined group and not that of members of any subgroups.
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
Group Reset
42 |
43 | ".web::escapeHTML($data['message'])."
";
46 | }
47 | ?>
48 |
49 |
50 |
Feature
51 |
Group:
52 | "?>
53 |
54 |
55 |
56 |
57 |
58 |
59 |
60 |
63 |
64 | "; ?>
65 |
66 |
67 | ";
69 | echo "";
76 | echo "
";
77 | }
78 | ?>
79 |
80 |
81 |
82 |
83 |
--------------------------------------------------------------------------------
/lib/util/SasStudent_util/README.md:
--------------------------------------------------------------------------------
1 | SasStudent Utility
2 | ==================
3 | This is a small utility for automating user account management via SAS2000. If you
4 | don't run that software, then you should not enable the utility.
5 |
6 | If you don't number user accounts according to the 'code' attribute, then you should
7 | also not enable this utility.
8 |
9 | Installation
10 | ------------
11 |
12 | On the Auth server, you need access to the sqsh command, and you need to install and configure FreeTDS to work with your version of Microsoft SQL Server. The instructions on [this blog post](http://le-gall.net/pierrick/blog/index.php/2006/09/06/79-how-to-use-linux-as-a-microsoft-sql-server-client) works for MSSQL 2008.
13 |
14 | On the Microsoft SQL server, create a _read-only_ user account for Auth to get
15 | its data from. Give it access to a simple view of student data. The view I use is:
16 |
17 | SELECT Code, FirstName, LastName, PreferredName, Year, Class, ID
18 | FROM dbo.Student
19 | WHERE (PreEnrolment = 'N')
20 |
21 | Next, enable the utility by adding an entry to the Util list in config.php:
22 |
23 | 'SasStudent' => 'SAS Student'
24 |
25 | And finally, add all of the configuration options that the utility will be using:
26 |
27 | 'SasStudent' =>
28 | array( 'host' => 'hostname',
29 | 'name' => 'databasename',
30 | 'user' => 'authusername',
31 | 'pass' => 'verysecretpassword',
32 | 'view' => 'dbo.authStudentView',
33 | // Service to check for accounts in
34 | 'check' =>'ldap',
35 | // Domain to check for accounts in
36 | 'domain' =>'(the domain where student accounts go)',
37 | // Services to create accounts on
38 | 'create' => array('ldap', 'something', 'something-else')
39 | )
40 |
--------------------------------------------------------------------------------
/lib/util/SasStudent_util/layout/main.inc:
--------------------------------------------------------------------------------
1 |
4 |
14 |
15 |
16 |
17 |
18 |
19 |
20 | What does this do?
21 |
22 |
This utility is responsible for sorting students into homerooms,
23 | and creating accounts automatically.
24 |
It relies on correct data in the SAS student database.
99 |
100 |
101 | " .
103 | "" .
104 | "\n";
105 | echo "\n";
108 | ?>
109 |
--------------------------------------------------------------------------------
/lib/util/SimonTeacherYL_util/README.md:
--------------------------------------------------------------------------------
1 | SimonTeacherYL Utility
2 | ======================
3 | This is a small utility for automating email distribution lists by using data from SIMON. If you
4 | don't run that software, then you should not enable this utility.
5 |
6 | Installation
7 | ------------
8 |
9 | On the Auth server, you need to install and configure TDS:
10 |
11 | apt-get install php5-odbc tdsodbc
12 |
13 | On the Microsoft SQL server, create a _read-only_ user account for Auth to get
14 | its data from. It only needs enough access to read from the following tables:
15 | - StudentClasses
16 | - FileSemesters
17 | - Community
18 | - SubjectClasses
19 | - SubjectClassStaff
20 | - Subjects
21 |
22 | Set up a ODBC datasource called 'simon'. These settings work for an SQL Server 2008 server:
23 |
24 | From odbc.ini:
25 |
26 | [simon]
27 | Database = YourDatabaseNameHere
28 | Server = x.x.x.x
29 | Driver = FreeTDS
30 | Description = SIMON
31 | Trace = Yes
32 | TraceFile = /tmp/sql.log
33 | ForceTrace = yes
34 | Port = 1433
35 | TDS_Version = 8.0
36 |
37 | And the FreeTDS driver in odbcinst.ini:
38 |
39 | [FreeTDS]
40 | Description=MSSQL DB
41 | Driver=/usr/lib/x86_64-linux-gnu/odbc/libtdsodbc.so
42 | UsageCount=1
43 |
44 | Next, enable the utility by adding an entry to the Util list in config.php:
45 |
46 | 'SimonTeacherYL' => 'Automatic mail groups'
47 |
48 | And finally, add the login username and password, plus some domain info to a new section in config.php:
49 |
50 | 'SimonTeacherYL' =>
51 | array(
52 | 'user' => 'authusername',
53 | 'pass' => 'verysecretpassword',
54 | 'domain_staff' => 'default',
55 | 'domain_student' => 'student',
56 | 'group_ou_name' => 'root',
57 | 'service_id' => 'ldap1',
58 | 'domain' => array('default' => 'example.com', 'student' => 'student.example.com')
59 | )
60 |
--------------------------------------------------------------------------------
/lib/util/util.php:
--------------------------------------------------------------------------------
1 | 500 Internal Server Error";
46 | echo "
Changing a login name will affect the user's ability to log in! Not only will they have to use a different username, but it will seriously break their windows profiles, and will confuse some email clients. This should only be done if absolutely necessary
16 |
To correct Windows user profiles, you will need to edit the logon name stored in the registry.
You can relocate a user to a different Organzational Unit for
29 | housekeeping. This will not affect email distribution, but some
30 | basic permissions (such as the ability to log in or connect to the
31 | wifi) will be changed if you move a user between the top-level
32 | units.
33 |
34 |
35 |
36 |
37 |
Move User
38 |
39 |
40 | ".Web::escapeHTML($data['message']) . "
";
43 | }
44 | ?>
45 |
46 | Select the organizational unit which owner_firstname . " " . $data['AccountOwner'] -> owner_surname); ?>
47 | should go in:
48 |
This resets the password for each of the services that this user has an account on. The password must meet the constraints for all of those services in order to be valid.
27 |
If you are trying to log in to something specific, then after this is set, you may wish to check the "Action Queue" to see whether the change has been applied to that service.
Because this system manages multiple back-end account-keeping
12 | systems, it would be really slow to use if you had to wait for it
13 | all the time!
14 |
While you are working, Auth puts together a "Todo" list with all
15 | the things you've changed, and applies the changes in its own time.
16 |
You can find all sorts of extra detail in the ActionQueue log file."?>
17 |
18 |
19 |
20 |
21 |
ActionQueue
22 |
23 |
The ActionQueue is empty.
";
26 | } else {
27 | echo "
Items are shown in approximate execution order:
";
28 | echo "
" .
29 | "
Action
Service
Domain
Target
Date
Attempts
";
30 | foreach($data['AQ'] as $aq) {
31 | echo "
".
32 | "
" . Web::escapeHTML($aq -> action_type) . "
" .
33 | "
" . Web::escapeHTML($aq -> Service -> service_name) . "
Changing the unit name affects every object in the organizational unit! If you rename a large unit, then you can expect issues to arise with authentication.
16 |
You should only rename a unit if its current name is incorrect.
When you add this group to a parent group, everybody here will
11 | receive emails and inherit the permissions associated with the
12 | parent group, in addition to whatever they already have.
13 |
14 |
15 |
16 |
17 |
18 | Add
19 | group_name) . "\""; ?>
20 | to group
21 |
A group is a collection of users, used for security purposes. A user account can be in many different groups, and will receive email messages sent to the group address.
Changing a group alias will affect email routing, but all users will stay in the group. Note that aliases are limited to alphanumeric characters for technical reasons.