zoneminder/web/includes/User.php

Ignoring revisions in .git-blame-ignore-revs. Click here to bypass and see the normal blame view.

53 lines
1.4 KiB
PHP
Raw Permalink Normal View History

2020-06-18 00:50:22 +08:00
<?php
namespace ZM;
require_once('database.php');
require_once('Object.php');
class User extends ZM_Object {
protected static $table = 'Users';
protected $defaults = array(
2020-10-07 23:16:02 +08:00
'Id' => null,
'Username' => '',
'Password' => '',
'Language' => '',
'Enabled' => 1,
'Stream' => 'None',
'Events' => 'None',
'Control' => 'None',
'Monitors' => 'None',
'Groups' => 'None',
'Devices' => 'None',
2021-04-13 01:43:29 +08:00
'Snapshots' => 'None',
2020-10-07 23:16:02 +08:00
'System' => 'None',
'MaxBandwidth' => '',
'MonitorIds' => '',
2020-06-18 00:50:22 +08:00
'TokenMinExpiry' => 0,
2020-10-07 23:16:02 +08:00
'APIEnabled' => 1,
'HomeView' => '',
2020-06-18 00:50:22 +08:00
);
public static function find( $parameters = array(), $options = array() ) {
return ZM_Object::_find(get_class(), $parameters, $options);
}
public static function find_one( $parameters = array(), $options = array() ) {
return ZM_Object::_find_one(get_class(), $parameters, $options);
}
public function Name( ) {
return $this->{'Username'};
}
public static function Indexed_By_Id() {
$results = array();
foreach ( ZM_Object::_find('ZM\User', null, array('order'=>'lower(Username)')) as $Object ) {
$results[$Object->Id()] = $Object;
}
return $results;
}
} # end class User
?>