Improvement fullName and labels - Audilog Kpi
This commit is contained in:
@@ -44,6 +44,9 @@ class Dashboard extends BaseDashboard
|
||||
$msg = 'Update ';
|
||||
$dashboard = DashboardPeer::retrieveByPK($data['DAS_UID']);
|
||||
}
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||
$this->setUser($data['USR_UID']);
|
||||
}
|
||||
|
||||
G::LoadSystem('inputfilter');
|
||||
$filter = new InputFilter();
|
||||
@@ -89,6 +92,10 @@ class Dashboard extends BaseDashboard
|
||||
$criteria->add(DashboardIndicatorPeer::DAS_UID, $dasUid);
|
||||
DashboardIndicatorPeer::doDelete($criteria);
|
||||
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||
$this->setUser($data['USR_UID']);
|
||||
}
|
||||
|
||||
$dashboard = DashboardPeer::retrieveByPK($dasUid);
|
||||
if (!is_null($dashboard)) {
|
||||
$connection->begin();
|
||||
@@ -96,7 +103,7 @@ class Dashboard extends BaseDashboard
|
||||
$result = $dashboard->delete();
|
||||
$connection->commit();
|
||||
|
||||
G::auditLog("Deletedashboard", "Dashboard Name: ". $dashboardData['DAS_TITLE']." Dashboard ID: (".$dasUid.") ");
|
||||
G::auditLog("Delete", "Dashboard Name: ". $dashboardData['DAS_TITLE']." Dashboard ID: (".$dasUid.") ");
|
||||
return $result;
|
||||
} else {
|
||||
throw new Exception('Error trying to delete: The row "' . $dasUid. '" does not exist.');
|
||||
@@ -106,5 +113,12 @@ class Dashboard extends BaseDashboard
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function setUser($usrId) {
|
||||
$user = new Users ();
|
||||
$user = $user->loadDetails($usrId);
|
||||
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -71,6 +71,9 @@ class DashboardDasInd extends BaseDashboardDasInd
|
||||
$result = $dashboardDasInd->save();
|
||||
$connection->commit();
|
||||
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||
$this->setUser($data['USR_UID']);
|
||||
}
|
||||
G::auditLog("Create", "Dashboard Owner: ". $data['OWNER_UID']." Dashboard ID: (".$dashboardDasInd->getDasUid().") ");
|
||||
return $dashboardDasInd;
|
||||
} else {
|
||||
@@ -87,7 +90,7 @@ class DashboardDasInd extends BaseDashboardDasInd
|
||||
}
|
||||
}
|
||||
|
||||
public function remove($dasUid, $owner)
|
||||
public function remove($dasUid, $owner, $userLogged='')
|
||||
{
|
||||
$connection = Propel::getConnection(DashboardDasIndPeer::DATABASE_NAME);
|
||||
try {
|
||||
@@ -97,7 +100,10 @@ class DashboardDasInd extends BaseDashboardDasInd
|
||||
$result = $dashboardDasInd->delete();
|
||||
$connection->commit();
|
||||
|
||||
G::auditLog("DeletedashboardIndicator", "Dashboard ID: ". $dasUid ." Dashboard owner ID: (".$owner.") ");
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && $userLogged != '') {
|
||||
$this->setUser($userLogged);
|
||||
}
|
||||
G::auditLog("Delete", "Dashboard ID: ". $dasUid ." Dashboard owner ID: (".$owner.") ");
|
||||
return $result;
|
||||
} else {
|
||||
throw new Exception('Error trying to delete: The row "' . $dasUid. '" does not exist.');
|
||||
@@ -143,5 +149,12 @@ class DashboardDasInd extends BaseDashboardDasInd
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function setUser($usrId) {
|
||||
$user = new Users ();
|
||||
$user = $user->loadDetails($usrId);
|
||||
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -159,6 +159,9 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
$result = $dashboardIndicator->save();
|
||||
$connection->commit();
|
||||
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && isset($data['USR_UID']) && $data['USR_UID'] != '') {
|
||||
$this->setUser($data['USR_UID']);
|
||||
}
|
||||
G::auditLog($msg, "Dashboard Indicator Name: ".$dashboardIndicator->getDasIndTitle()." Dashboard indicator ID: (".$dashboardIndicator->getDasIndUid() .") ");
|
||||
return $dashboardIndicator->getDasIndUid();
|
||||
} else {
|
||||
@@ -175,7 +178,7 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
}
|
||||
}
|
||||
|
||||
public function remove($dasIndUid)
|
||||
public function remove($dasIndUid, $userLogged ='')
|
||||
{
|
||||
$connection = Propel::getConnection(DashboardIndicatorPeer::DATABASE_NAME);
|
||||
try {
|
||||
@@ -186,7 +189,10 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
$result = $dashboardIndicator->delete();
|
||||
$connection->commit();
|
||||
|
||||
G::auditLog("DeletedashboardIndicator", "Dashboard Indicator Name: ". $dashboardIndicatorData['DAS_IND_TITLE']." Dashboard Instance ID: (".$dasIndUid.") ");
|
||||
if ((!isset($_SESSION['USER_LOGGED']) || $_SESSION['USER_LOGGED'] == '') && $userLogged != '') {
|
||||
$this->setUser($userLogged);
|
||||
}
|
||||
G::auditLog("Delete", "Dashboard Indicator Name: ". $dashboardIndicatorData['DAS_IND_TITLE']." Dashboard Instance ID: (".$dasIndUid.") ");
|
||||
return $result;
|
||||
} else {
|
||||
throw new Exception('Error trying to delete: The row "' . $dasIndUid. '" does not exist.');
|
||||
@@ -196,5 +202,12 @@ class DashboardIndicator extends BaseDashboardIndicator
|
||||
throw $error;
|
||||
}
|
||||
}
|
||||
|
||||
public function setUser($usrId) {
|
||||
$user = new Users ();
|
||||
$user = $user->loadDetails($usrId);
|
||||
$_SESSION['USER_LOGGED'] = $user['USR_UID'];
|
||||
$_SESSION['USR_FULLNAME'] = $user['USR_FULLNAME'];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -326,16 +326,17 @@ class Dashboard {
|
||||
* Delete Dashboard owner
|
||||
*
|
||||
* @param string $das_uid
|
||||
* @param string $owner_uid
|
||||
* @param string $owner_uid
|
||||
* * @param string $usr_uid
|
||||
*
|
||||
* return void
|
||||
*
|
||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||
*/
|
||||
public function deleteDashboardOwner($das_uid, $owner_uid)
|
||||
public function deleteDashboardOwner($das_uid, $owner_uid, $usr_uid)
|
||||
{
|
||||
$dashboard = new \DashboardDasInd();
|
||||
$response = $dashboard->remove($das_uid, $owner_uid);
|
||||
$response = $dashboard->remove($das_uid, $owner_uid, $usr_uid);
|
||||
return $response;
|
||||
}
|
||||
|
||||
@@ -359,15 +360,16 @@ class Dashboard {
|
||||
* Delete Indicator
|
||||
*
|
||||
* @param string $das_ind_uid Unique id
|
||||
* @param string $usr_uid
|
||||
*
|
||||
* return void
|
||||
*
|
||||
* @author Marco Antonio Nina <marco.antonio.nina@colosa.com>
|
||||
*/
|
||||
public function delete($das_ind_uid)
|
||||
public function delete($das_ind_uid, $usr_uid)
|
||||
{
|
||||
$dashboard = new \DashboardIndicator();
|
||||
$response = $dashboard->remove($das_ind_uid);
|
||||
$response = $dashboard->remove($das_ind_uid, $usr_uid);
|
||||
return $response;
|
||||
}
|
||||
|
||||
|
||||
@@ -238,6 +238,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$request_data['USR_UID'] = $this->getUserId();
|
||||
$response = $dashboard->createDashboard($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -260,6 +261,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$request_data['USR_UID'] = $this->getUserId();
|
||||
$response = $dashboard->createDashboard($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -279,6 +281,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$request_data['USR_UID'] = $this->getUserId();
|
||||
$response = $dashboard->deletedashboard($das_uid);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -300,6 +303,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$request_data['USR_UID'] = $this->getUserId();
|
||||
$response = $dashboard->createOwner($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -320,7 +324,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$response = $dashboard->deleteDashboardOwner($das_uid, $owner_uid);
|
||||
$response = $dashboard->deleteDashboardOwner($das_uid, $owner_uid, $this->getUserId());
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
@@ -341,6 +345,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$request_data['USR_UID'] = $this->getUserId();
|
||||
$response = $dashboard->createIndicator($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -363,6 +368,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$request_data['USR_UID'] = $this->getUserId();
|
||||
$response = $dashboard->createIndicator($request_data);
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
@@ -382,7 +388,7 @@ class Dashboard extends Api
|
||||
{
|
||||
try {
|
||||
$dashboard = new \ProcessMaker\BusinessModel\Dashboard();
|
||||
$response = $dashboard->delete($ind_uid);
|
||||
$response = $dashboard->delete($ind_uid, $this->getUserId());
|
||||
return $response;
|
||||
} catch (\Exception $e) {
|
||||
throw (new RestException(Api::STAT_APP_EXCEPTION, $e->getMessage()));
|
||||
|
||||
Reference in New Issue
Block a user