2013-10-20 16:24:09 +00:00
|
|
|
<?php
|
2019-01-25 13:51:46 +00:00
|
|
|
if (!defined('sugarEntry') || !sugarEntry) {
|
|
|
|
die('Not A Valid Entry Point');
|
|
|
|
}
|
2013-10-20 16:24:09 +00:00
|
|
|
|
|
|
|
|
|
|
|
require_once('data/SugarBean.php');
|
|
|
|
|
|
|
|
// Contact is used to store customer information.
|
2019-01-25 13:51:46 +00:00
|
|
|
class SecurityGroupUserRelationship extends SugarBean
|
|
|
|
{
|
2013-10-20 16:24:09 +00:00
|
|
|
// Stored fields
|
2018-07-31 14:24:44 +00:00
|
|
|
var $id;
|
|
|
|
var $securitygroup_id;
|
|
|
|
var $securitygroup_noninheritable;
|
|
|
|
var $user_id;
|
|
|
|
var $noninheritable;
|
|
|
|
var $primary_group;
|
2016-03-24 09:22:57 +00:00
|
|
|
|
2013-10-20 16:24:09 +00:00
|
|
|
// Related fields
|
2018-07-31 14:24:44 +00:00
|
|
|
var $securitygroup_name;
|
|
|
|
var $user_name;
|
2013-10-20 16:24:09 +00:00
|
|
|
|
2018-07-31 14:24:44 +00:00
|
|
|
var $table_name = "securitygroups_users";
|
|
|
|
var $object_name = "SecurityGroupUserRelationship";
|
2019-01-25 14:12:37 +00:00
|
|
|
var $column_fields = array("id"
|
2013-10-20 16:24:09 +00:00
|
|
|
,"securitygroup_id"
|
|
|
|
,"user_id"
|
|
|
|
,"noninheritable"
|
|
|
|
,"primary_group"
|
|
|
|
,'date_modified'
|
|
|
|
);
|
|
|
|
|
2018-07-31 14:24:44 +00:00
|
|
|
var $new_schema = true;
|
2016-03-24 09:22:57 +00:00
|
|
|
|
2019-01-25 14:12:37 +00:00
|
|
|
var $additional_column_fields = array();
|
2019-01-25 13:51:46 +00:00
|
|
|
var $field_defs = array (
|
2013-10-20 16:24:09 +00:00
|
|
|
'id'=>array('name' =>'id', 'type' =>'char', 'len'=>'36', 'default'=>'')
|
|
|
|
, 'securitygroup_id'=>array('name' =>'securitygroup_id', 'type' =>'char', 'len'=>'36', )
|
|
|
|
, 'user_id'=>array('name' =>'user_id', 'type' =>'char', 'len'=>'36',)
|
|
|
|
, 'noninheritable'=>array('name' =>'noninheritable', 'type' =>'bool', 'len'=>'1')
|
|
|
|
, 'primary_group'=>array('name' =>'primary_group', 'type' =>'bool', 'len'=>'1')
|
2018-07-31 14:24:44 +00:00
|
|
|
, 'date_modified'=>array ('name' => 'date_modified','type' => 'datetime')
|
2013-10-20 16:24:09 +00:00
|
|
|
, 'deleted'=>array('name' =>'deleted', 'type' =>'bool', 'len'=>'1', 'default'=>'0', 'required'=>true)
|
|
|
|
);
|
2019-01-25 13:51:46 +00:00
|
|
|
function __construct()
|
|
|
|
{
|
2013-10-20 16:24:09 +00:00
|
|
|
$this->db = DBManagerFactory::getInstance();
|
|
|
|
$this->dbManager = DBManagerFactory::getInstance();
|
|
|
|
|
|
|
|
$this->disable_row_level_security =true;
|
2019-01-25 13:51:46 +00:00
|
|
|
}
|
2013-10-20 16:24:09 +00:00
|
|
|
|
2016-04-29 14:12:28 +00:00
|
|
|
/**
|
|
|
|
* @deprecated deprecated since version 7.6, PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code, use __construct instead
|
|
|
|
*/
|
2019-01-25 13:51:46 +00:00
|
|
|
function SecurityGroupUserRelationship()
|
|
|
|
{
|
2016-04-29 14:12:28 +00:00
|
|
|
$deprecatedMessage = 'PHP4 Style Constructors are deprecated and will be remove in 7.8, please update your code';
|
2019-01-25 13:51:46 +00:00
|
|
|
if (isset($GLOBALS['log'])) {
|
2016-04-29 14:12:28 +00:00
|
|
|
$GLOBALS['log']->deprecated($deprecatedMessage);
|
2019-01-25 13:51:46 +00:00
|
|
|
} else {
|
2016-04-29 14:12:28 +00:00
|
|
|
trigger_error($deprecatedMessage, E_USER_DEPRECATED);
|
|
|
|
}
|
|
|
|
self::__construct();
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2018-07-31 14:24:44 +00:00
|
|
|
function fill_in_additional_detail_fields()
|
2013-10-20 16:24:09 +00:00
|
|
|
{
|
2019-01-25 13:51:46 +00:00
|
|
|
if (isset($this->securitygroup_id) && $this->securitygroup_id != "") {
|
2013-10-20 16:24:09 +00:00
|
|
|
$query = "SELECT name from securitygroups where id='$this->securitygroup_id' AND deleted=0";
|
2019-01-25 14:14:52 +00:00
|
|
|
$result =$this->db->query($query, true, " Error filling in additional detail fields: ");
|
2013-10-20 16:24:09 +00:00
|
|
|
// Get the id and the name.
|
|
|
|
$row = $this->db->fetchByAssoc($result);
|
|
|
|
|
2019-01-25 13:51:46 +00:00
|
|
|
if ($row != null) {
|
2013-10-20 16:24:09 +00:00
|
|
|
$this->securitygroup_name = $row['name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2019-01-25 13:51:46 +00:00
|
|
|
if (isset($this->user_id) && $this->user_id != "") {
|
2013-10-20 16:24:09 +00:00
|
|
|
$query = "SELECT user_name from users where id='$this->user_id' AND deleted=0";
|
2019-01-25 14:14:52 +00:00
|
|
|
$result =$this->db->query($query, true, " Error filling in additional detail fields: ");
|
2013-10-20 16:24:09 +00:00
|
|
|
// Get the id and the name.
|
|
|
|
$row = $this->db->fetchByAssoc($result);
|
|
|
|
|
2019-01-25 13:51:46 +00:00
|
|
|
if ($row != null) {
|
2013-10-20 16:24:09 +00:00
|
|
|
$this->user_name = $row['user_name'];
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2018-07-31 14:24:44 +00:00
|
|
|
function create_list_query(&$order_by, &$where)
|
2013-10-20 16:24:09 +00:00
|
|
|
{
|
|
|
|
$query = "SELECT id, first_name, last_name, user_name FROM users ";
|
|
|
|
$where_auto = "deleted=0";
|
|
|
|
|
2019-01-25 13:51:46 +00:00
|
|
|
if ($where != "") {
|
2013-10-20 16:24:09 +00:00
|
|
|
$query .= "where $where AND ".$where_auto;
|
2019-01-25 13:51:46 +00:00
|
|
|
} else {
|
2013-10-20 16:24:09 +00:00
|
|
|
$query .= "where ".$where_auto;
|
2019-01-25 13:51:46 +00:00
|
|
|
}
|
2013-10-20 16:24:09 +00:00
|
|
|
|
|
|
|
$query .= " ORDER BY last_name, first_name";
|
|
|
|
|
|
|
|
return $query;
|
|
|
|
}
|
|
|
|
}
|