Skip to content

Commit

Permalink
account service structure
Browse files Browse the repository at this point in the history
  • Loading branch information
Michael Billington committed Apr 28, 2013
1 parent ac13c55 commit 854a2c9
Show file tree
Hide file tree
Showing 7 changed files with 191 additions and 0 deletions.
6 changes: 6 additions & 0 deletions .buildpath
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?>
<buildpath>
<buildpathentry kind="src" path="lib/service"/>
<buildpathentry kind="src" path="site"/>
<buildpathentry kind="con" path="org.eclipse.php.core.LANGUAGE"/>
</buildpath>
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
site/*
22 changes: 22 additions & 0 deletions .project
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
<?xml version="1.0" encoding="UTF-8"?>
<projectDescription>
<name>Auth</name>
<comment></comment>
<projects>
</projects>
<buildSpec>
<buildCommand>
<name>org.eclipse.wst.validation.validationbuilder</name>
<arguments>
</arguments>
</buildCommand>
<buildCommand>
<name>org.eclipse.dltk.core.scriptbuilder</name>
<arguments>
</arguments>
</buildCommand>
</buildSpec>
<natures>
<nature>org.eclipse.php.core.PHPNature</nature>
</natures>
</projectDescription>
2 changes: 2 additions & 0 deletions .settings/org.eclipse.php.core.prefs
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
eclipse.preferences.version=1
include_path=0;/Auth
121 changes: 121 additions & 0 deletions lib/service/account_service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,121 @@
<?php
/**
* This abstract class provides an interface for interacting with most account-providing services.
*
* @author Michael Billington <michael.billington@gmail.com>
*/
abstract class account_service {
/**
* Make a new user account on this service.
*
* @param Account_model $a The account to create
*/
abstract protected function accountCreate(Account_model $a);

/**
* Delete a user account from this service.
*
* @param string $account_login The login name of the account
* @param string $account_domain The domain which the account is on (services may serve multiple domains)
*/
abstract protected function accountDelete(string $account_login, string $account_domain);


/**
* Update the login and display name for an account.
*
* @param Account_model $a The new account details
* @param string $account_login The username to search for -- If an account has been renamed, then this will be different to the username stored in the above object.
*/
abstract protected function accountUpdate(Account_model $a, string $account_login);

/**
* Disable a user account.
*
* @param Account_model $a The user account to disable
*/
abstract protected function accountDisable(Account_model $a);

/**
* Enable a user account.
*
* @param Account_model $a The user account to enable
*/
abstract protected function accountEnable(Account_model $a);

/**
* Re-base an account under a different organizational unit.
*
* @param Account_model $a
*/
abstract protected function accountRelocate(Account_model $a);

/**
* Search an organizational unit recursively, looking for changes.
*
* @param Ou_model $o The organizational unit to search.
*/
abstract protected function recursiveSearch(Ou_model $o);

/**
* Create a new group.
*
* @param Group_model $g The group to create.
*/
abstract protected function groupCreate(UserGroup_model $g);

/**
* Delete a group.
*
* @param Group_model $g
*/
abstract protected function groupDelete(string $group_cn, string $group_domain);

/**
* Add a user account to a group.
*
* @param Account_model $a The user account to add
* @param Group_model $g The group to add it to
*/
abstract protected function groupJoin(Account_model $a, Group_model $g);

/**
* Remove a user account from a group.
*
* @param Account_model $a The user account to remove
* @param Group_model $g The group to remove it from
*/
abstract protected function groupLeave(Account_model $a, Group_model $g);

/**
* Add a group to a group.
*
* @param Group_model $parent The parent group
* @param Group_model $child The group to add
*/
abstract protected function groupAddChild(Group_model $parent, Group_model $child);

/**
* Remove a group from a group.
*
* @param Group_model $parent The parent group
* @param Group_model $child The group to remove
*/
abstract protected function groupDelChild(Group_model $parent, Group_model $child);

/**
* Create a new organizational unit.
*
* @param Ou_model $o The organizational unit to create
*/
abstract protected function ouCreate(Ou_model $o);


/**
* Delete an organizational unit.
*
* @param string $ou_id The name of the unit
*/
abstract protected function ouDelete(string $ou_id);
}
?>
11 changes: 11 additions & 0 deletions lib/service/ad_service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

require_once(dirname(__FILE__) . "/ad_service.php");

class ad_service extends ldap_service {



}

?>
28 changes: 28 additions & 0 deletions lib/service/ldap_service.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?php

require_once(dirname(__FILE__) . "/account_service.php");

class ldap_service extends account_service {
private $ldap_url;
private $ldap_user;
private $ldap_root;
private $ldap_pass;

/**
* Construct a new LDAP service object
*
* @param string $ldap_url The URL of the ldap server. Looks like "ldaps://<hostname>:<port>".
* @param string $ldap_user The username to log in as. Usually "cn=admin,dc=..,dc=.." or "Administrator@<domain name>" for Active Directory.
* @param string $root The root of the domain. Looks like "dc=example,dc=com".
* @param string $ldap_pass The password to use when logging in to this server.
*/
function __construct(string $ldap_url, string $ldap_user, string $ldap_root, string $ldap_pass) {
$this -> ldap_url = $ldap_url;
$this -> ldap_user = $ldap_user;
$this -> ldap_root = $ldap_root;
$this -> ldap_pass = $ldap_pass;
}


}
?>

0 comments on commit 854a2c9

Please sign in to comment.