Example #1
0
 /**
  * This function is called after the dependencies have been injected by
  * AutoPilot. Think of it as a user-land constructor.
  */
 public function airshipLand()
 {
     parent::airshipLand();
     $this->users = $this->blueprint('UserAccounts');
     $userId = $this->getActiveUserId();
     $this->userUniqueId = $this->users->getUniqueId($userId);
     $this->root_dir = 'user/' . $this->userUniqueId;
     $this->files->ensureDirExists($this->root_dir);
     $this->path_middle = 'my/files';
     $this->attribution = ['author' => null, 'uploaded_by' => $userId];
     $this->storeLensVar('path_middle', $this->path_middle);
     $this->storeLensVar('active_link', 'bridge-link-my-files');
     $this->storeLensVar('header', 'My Files');
     $this->storeLensVar('title', 'My Files');
 }
Example #2
0
 function addOTPatRegister($otpNum, $regId, $otpCount)
 {
     $dbObj = new InteractDatabase();
     $acc = new UserAccounts();
     // Check Already Registration Number exist or not
     $result = $acc->checkRegIDExist($regId);
     if ($result == 'NotExist' && $regId != 0) {
         $sql = "INSERT INTO `userlogin`(`idUserRegistration`, `OTPCode`, `OTPCount`) VALUES (" . $regId . ",'" . $otpNum . "','" . $otpCount . "')";
         $dbObj->addupdateData($sql);
     } else {
         // Get OTPCount
         $gsql = "SELECT OTPCount FROM `userlogin` WHERE `idUserRegistration`=" . $regId;
         $json = $dbObj->getJSONData($gsql);
         $dejson = json_decode($json);
         $otpcount = $dejson[0]->{'OTPCount'};
         $otpcount++;
         $usql = "UPDATE `userlogin` SET `OTPCode`='" . $otpcount . "', `OTPCode`='" . $otpNum . "' WHERE `idUserRegistration`=" . $regId;
         $dbObj->addupdateData($usql);
     }
 }
Example #3
0
 /**
  * Obtiene el listado usuarios con acceso a una cuenta.
  * Lo almacena en la cache de sesión como array de cuentas
  *
  * @return array Con los registros con id de cuenta como clave e id de usuario como valor
  */
 public function getUsersAccount()
 {
     $accId = $this->getAccountId();
     $cacheUsers =& $_SESSION['cache']['usersId'];
     if (!is_array($cacheUsers)) {
         $cacheUsers = array($accId => array(), 'expires' => 0);
     }
     if (!isset($cacheUsers[$accId]) || time() > $cacheUsers['expires']) {
         $cacheUsers[$accId] = UserAccounts::getUsersForAccount($accId);
         $cacheUsers['expires'] = time() + self::CACHE_EXPIRE_TIME;
     }
     return $cacheUsers[$accId];
 }
Example #4
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getIdUsuarioDestino()
 {
     return $this->hasOne(UserAccounts::className(), ['id' => 'id_usuario_destino']);
 }
Example #5
0
 /**
  * Elimina los datos de una cuenta en la BBDD.
  *
  * @return bool
  */
 public function deleteAccount()
 {
     // Guardamos una copia de la cuenta en el histórico
     AccountHistory::addHistory($this->getAccountId(), true) || die(_('ERROR: Error en la operación.'));
     $accountInfo = array('account_name,customer_name');
     $this->getAccountInfoById($accountInfo);
     $Log = new Log(_('Eliminar Cuenta'));
     $Log->addDescription(Html::strongText(_('Cliente') . ': ') . $this->_cacheParams['customer_name']);
     $Log->addDescription(Html::strongText(_('Cuenta') . ': ') . $this->_cacheParams['account_name'] . " (" . $this->getAccountId() . ")");
     $query = 'DELETE FROM accounts WHERE account_id = :id LIMIT 1';
     $data['id'] = $this->getAccountId();
     if (DB::getQuery($query, __FUNCTION__, $data) === false) {
         return false;
     }
     if (!Groups::deleteGroupsForAccount($this->getAccountId())) {
         $Log->addDescription(_('Error al eliminar grupos asociados a la cuenta'));
     }
     if (!UserAccounts::deleteUsersForAccount($this->getAccountId())) {
         $Log->addDescription(_('Error al eliminar usuarios asociados a la cuenta'));
     }
     if (!Files::deleteAccountFiles($this->getAccountId())) {
         $Log->addDescription(_('Error al eliminar archivos asociados a la cuenta'));
     }
     $Log->writeLog();
     Email::sendEmail($Log);
     return true;
 }
Example #6
0
<?php

require_once "utils/Router.php";
Requester::init();
if (!Requester::$user_id) {
    require_once "login.php";
} else {
    require_once "models/UserAccounts.php";
    $UserAccounts = new UserAccounts(json_decode('{"user_id": ' . Requester::$user_id . '}'));
    $UserAccounts->get();
    //print_r($UserAccounts);
    header('content-type: text/html');
    ?>
<html>
<head>
	<title>Pay XTH</title>
	<script type="text/javascript" src="/common2/lib/jQuery/jquery-1.8.2.min.js"></script>
	<style>
		#payDiv .inputLabel {
			display: inline-block;
			width: 5rem;
		} 
		
		#from, #to, #amount {
			width: 12rem;
		}
	</style>
</head>
<body>
	<div id='payDiv'>
		<h2 id='payDivTitle'></h2>
Example #7
0
 /**
  * @param int $contextId
  * @param string $username
  * @param string $cabin
  */
 protected function getPermissionsDataForUser(int $contextId, string $username, string $cabin)
 {
     $perm_bp = $this->blueprint('Permissions');
     $user_bp = $this->blueprint('UserAccounts');
     if (IDE_HACKS) {
         $db = \Airship\get_database();
         $perm_bp = new Permissions($db);
         $user_bp = new UserAccounts($db);
     }
     $user = $user_bp->getUserByUsername($username, true);
     if (empty($user)) {
         \Airship\json_response(['status' => 'ERROR', 'message' => \__('There is no user with that username in the system')]);
     }
     $userPerms = $perm_bp->getUserPerms($user['userid'], $contextId);
     $actions = $perm_bp->getActionNames($cabin);
     $perms = [];
     foreach ($actions as $action) {
         $perms[$action] = \in_array($action, $userPerms);
     }
     \Airship\json_response(['status' => 'OK', 'message' => $this->lensRender('perms/user', ['user' => $user, 'actions' => $actions, 'perms' => $perms])]);
 }
<?php

/* 
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
require 'dal.useraccounts.php';
header('Content-type: application/excel');
header("Content-Disposition: attachment;Filename=user-details-" . date('d-m-Y') . ".csv");
$data = "NAME" . ",";
$data .= "DESIGNATION" . ",";
$data .= "STAFF-ID" . ",";
$data .= "MOBILE" . ",";
$data .= "STATE" . "\n";
$acc = new UserAccounts();
$json = $acc->adminGetUserDetails();
//echo $json;
$dejson = json_decode($json);
for ($ind = 0; $ind < count($dejson); $ind++) {
    $data .= $dejson[$ind]->{'firstName'} . " " . $dejson[$ind]->{'lastName'} . ",";
    $data .= $dejson[$ind]->{'designation'} . ",";
    $data .= $dejson[$ind]->{'staffID'} . ",";
    $data .= $dejson[$ind]->{'mobile'} . ",";
    $data .= $dejson[$ind]->{'state'} . "\n";
}
echo $data;
Example #9
0
     $acc = new UserAccounts();
     $json = $acc->userCourseDesignationReports();
     echo $json;
 } else {
     if ($action == 'GetUserReportStateFilter') {
         $acc = new UserAccounts();
         $json = $acc->userCourseStateReports();
         echo $json;
     } else {
         if ($action == 'GetUserReportCourseNameFilter') {
             $acc = new UserAccounts();
             $json = $acc->userCourseCourseNameReports();
             echo $json;
         } else {
             if ($action == 'GetAdminUserReports') {
                 $acc = new UserAccounts();
                 $json = $acc->userCourseReports();
                 $dejson = json_decode($json);
                 $data = "{\"data\": [";
                 for ($ind = 0; $ind < count($dejson); $ind++) {
                     $data .= "[";
                     $data .= "\"" . $dejson[$ind]->{'firstName'} . " " . $dejson[$ind]->{'lastName'} . "\",";
                     $data .= "\"" . $dejson[$ind]->{'designation'} . "\",";
                     $data .= "\"" . $dejson[$ind]->{'courseName'} . "\",";
                     $data .= "\"" . $dejson[$ind]->{'testType'} . "\",";
                     $data .= "\"" . $dejson[$ind]->{'marksResults'} . "\"";
                     $data .= "],";
                 }
                 $data = chop($data, ",");
                 $data .= "]}";
                 echo $data;
Example #10
0
 /**
  * @return \yii\db\ActiveQuery
  */
 public function getUsuarioCreacion()
 {
     return $this->hasOne(UserAccounts::className(), ['id' => 'usuario_creacion']);
 }