version 1.1.1.1, 2007/11/02 20:55:00
|
version 1.1.1.1.2.1, 2007/11/13 07:36:19
|
Line 24
|
Line 24
|
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF |
# SUCH DAMAGE. |
# SUCH DAMAGE. |
# |
# |
|
# $Paefchen$ |
# $MCom: portstools/tinderbox/webui/module/moduleUsers.php,v 1.18 2007/10/13 02:28:48 ade Exp $ |
# $MCom: portstools/tinderbox/webui/module/moduleUsers.php,v 1.18 2007/10/13 02:28:48 ade Exp $ |
# |
# |
|
|
require_once 'module/module.php'; |
|
require_once 'module/moduleBuilds.php'; |
|
|
|
class moduleUsers extends module { |
class moduleUsers extends module { |
|
|
var $permissions; | private $permissions = null; |
| private $moduleBuilds = null; |
|
|
function moduleUsers() { | public function __construct() { |
$this->module(); | parent::__construct(); |
$this->moduleBuilds = new moduleBuilds(); | $this->moduleBuilds = new moduleBuilds; |
} |
} |
|
|
function display_login() { | public function display_login() { |
global $moduleSession; |
global $moduleSession; |
|
|
if( $this->is_logged_in() ) { |
if( $this->is_logged_in() ) { |
Line 59 class moduleUsers extends module {
|
Line 58 class moduleUsers extends module {
|
return $this->template_parse( 'display_login.tpl' ); |
return $this->template_parse( 'display_login.tpl' ); |
} |
} |
|
|
function display_add_user( $user_name, $user_email, $user_password, $www_enabled ) { | public function display_add_user( $user_name, $user_email, $user_password, $www_enabled ) { |
if( !$this->is_logged_in() ) { |
if( !$this->is_logged_in() ) { |
return $this->template_parse( 'please_login.tpl' ); |
return $this->template_parse( 'please_login.tpl' ); |
} elseif ( $this->checkWwwAdmin() ) { |
} elseif ( $this->checkWwwAdmin() ) { |
Line 75 class moduleUsers extends module {
|
Line 74 class moduleUsers extends module {
|
return $this->template_parse( 'user_admin.tpl' ); |
return $this->template_parse( 'user_admin.tpl' ); |
} |
} |
|
|
function display_modify_user( $first, $user_id, $user_name, $user_email, $user_password, $www_enabled ) { | public function display_modify_user( $first, $user_id, $user_name, $user_email, $user_password, $www_enabled ) { |
if( !$this->is_logged_in() ) { |
if( !$this->is_logged_in() ) { |
return $this->template_parse( 'please_login.tpl' ); |
return $this->template_parse( 'please_login.tpl' ); |
} |
} |
Line 101 class moduleUsers extends module {
|
Line 100 class moduleUsers extends module {
|
return $this->template_parse( 'user_admin.tpl' ); |
return $this->template_parse( 'user_admin.tpl' ); |
} |
} |
|
|
function display_properties( $user_id, $user_name, $user_email, $user_password, $www_enabled ) { | public function display_properties( $user_id, $user_name, $user_email, $user_password, $www_enabled ) { |
$this->template_assign( 'user_id', $user_id ); |
$this->template_assign( 'user_id', $user_id ); |
$this->template_assign( 'user_name', $user_name ); |
$this->template_assign( 'user_name', $user_name ); |
$this->template_assign( 'user_email', $user_email ); |
$this->template_assign( 'user_email', $user_email ); |
Line 111 class moduleUsers extends module {
|
Line 110 class moduleUsers extends module {
|
return $this->template_parse( 'user_properties.tpl' ); |
return $this->template_parse( 'user_properties.tpl' ); |
} |
} |
|
|
function action_user( $action, $user_id, $user_name, $user_email, $user_password, $www_enabled ) { | public function action_user( $action, $user_id, $user_name, $user_email, $user_password, $www_enabled ) { |
if( !$this->is_logged_in() ) { |
if( !$this->is_logged_in() ) { |
return $this->template_parse( 'please_login.tpl' ); |
return $this->template_parse( 'please_login.tpl' ); |
} elseif( empty( $user_name ) ) { |
} elseif( empty( $user_name ) ) { |
Line 207 class moduleUsers extends module {
|
Line 206 class moduleUsers extends module {
|
return '1'; |
return '1'; |
} |
} |
|
|
function do_login( $username, $password ) { | public function do_login( $username, $password ) { |
global $moduleSession; |
global $moduleSession; |
|
|
$user = $this->TinderboxDS->getUserByLogin( $username, $password ); |
$user = $this->TinderboxDS->getUserByLogin( $username, $password ); |
Line 225 class moduleUsers extends module {
|
Line 224 class moduleUsers extends module {
|
return false; |
return false; |
} |
} |
|
|
function do_logout() { | public function do_logout() { |
global $moduleSession; |
global $moduleSession; |
|
|
$moduleSession->removeAttribute( 'user' ); |
$moduleSession->removeAttribute( 'user' ); |
Line 234 class moduleUsers extends module {
|
Line 233 class moduleUsers extends module {
|
return true; |
return true; |
} |
} |
|
|
function is_logged_in() { | public function is_logged_in() { |
global $moduleSession; |
global $moduleSession; |
|
|
$user = $moduleSession->getAttribute( 'user' ); |
$user = $moduleSession->getAttribute( 'user' ); |
Line 245 class moduleUsers extends module {
|
Line 244 class moduleUsers extends module {
|
return false; |
return false; |
} |
} |
|
|
function get_www_enabled() { | public function get_www_enabled() { |
global $moduleSession; |
global $moduleSession; |
$user = $moduleSession->getAttribute( 'user' ); |
$user = $moduleSession->getAttribute( 'user' ); |
|
|
Line 257 class moduleUsers extends module {
|
Line 256 class moduleUsers extends module {
|
return false; |
return false; |
} |
} |
|
|
function get_id() { | public function get_id() { |
global $moduleSession; |
global $moduleSession; |
$user = $moduleSession->getAttribute( 'user' ); |
$user = $moduleSession->getAttribute( 'user' ); |
|
|
return $user->getId(); |
return $user->getId(); |
} |
} |
|
|
function get_all_users() { | public function get_all_users() { |
$all_users_raw = $this->TinderboxDS->getAllUsers(); |
$all_users_raw = $this->TinderboxDS->getAllUsers(); |
$all_users = array(); |
$all_users = array(); |
foreach( $all_users_raw as $user ) { |
foreach( $all_users_raw as $user ) { |
Line 273 class moduleUsers extends module {
|
Line 272 class moduleUsers extends module {
|
return $all_users; |
return $all_users; |
} |
} |
|
|
function fetch_permissions( $object_type, $object_id ) { | public function fetch_permissions( $object_type, $object_id ) { |
global $moduleSession; |
global $moduleSession; |
|
|
if( $this->is_logged_in() ) { |
if( $this->is_logged_in() ) { |
Line 288 class moduleUsers extends module {
|
Line 287 class moduleUsers extends module {
|
} |
} |
} |
} |
|
|
function get_permission( $object_type, $object_id, $permission ) { | public function get_permission( $object_type, $object_id, $permission ) { |
if( !is_array( $this->permissions[$object_type][$object_id] ) && !isset( $this->permissions[$object_type][$object_id]['set'] ) ) { |
if( !is_array( $this->permissions[$object_type][$object_id] ) && !isset( $this->permissions[$object_type][$object_id]['set'] ) ) { |
$this->fetch_permissions( $object_type, $object_id ); |
$this->fetch_permissions( $object_type, $object_id ); |
} |
} |
Line 299 class moduleUsers extends module {
|
Line 298 class moduleUsers extends module {
|
} |
} |
} |
} |
|
|
function checkWwwAdmin() { | public function checkWwwAdmin() { |
return $this->get_permission( 'users', $this->get_id(), 'IS_WWW_ADMIN' ); |
return $this->get_permission( 'users', $this->get_id(), 'IS_WWW_ADMIN' ); |
} |
} |
} |
} |
|
|
|
/* old? |
function checkPermAddQueue( $object_type, $object_id ) { |
function checkPermAddQueue( $object_type, $object_id ) { |
return $this->get_permission( $object_type, $object_id, 'PERM_ADD_QUEUE' ); |
return $this->get_permission( $object_type, $object_id, 'PERM_ADD_QUEUE' ); |
} |
} |
Line 329 class moduleUsers extends module {
|
Line 329 class moduleUsers extends module {
|
{ |
{ |
return $this->get_permission( $object_type, $object_id, 'PERM_DELETE_OTHER_QUEUE' ); |
return $this->get_permission( $object_type, $object_id, 'PERM_DELETE_OTHER_QUEUE' ); |
} |
} |
|
*/ |
|
|
?> |
?> |