Manually Developed CI Controller
This controller facilitates the access of table countries
Usage:-
function index(), default index funtion to list all AIR entries
function validate_remote_host(), To validate remote host
function validate_app(), To validate application
function get_uaacs_feed_by_app_id(), To get uaacs application feed by app id
function get_calling_app_name(), To get calling app name
function issueToken(), To issue token
function generateToken(), To generate token for issuing
function get_called_app_function_id(), To get called application function id
function getTimeStamp(), To get time stamp
function getHostIP(), To get host IP
function getUserId(), To get user id
function getRandomString(), To get random string
function getAppId(), To get app id
function verify_token(), To verify given token
function verify_user_access(), To verify user access
function verify_permission(), To verify permission
function verify_role(), To verify role
function view_log(), To view log
function get_user_ip(), To get user ip
function get_jason(), To get json
function get_related_links(), To get related AIR links
function createDropdown(), To get dropdown listing with AIR linkagse
function set_called_app_name(), To set caled application name
function get_called_app_name(), To get caled application name
package |
AIR\controllers\Appregistrar |
---|---|
version |
V1.2.0 |
copyright |
2015, BizyCorp Internal Systems Development |
license |
private, All rights reserved |
author |
MRM Roshan |
created |
July 2014 |
uses | |
see | |
modified |
28/04/2016 by MRM Roshan |
modification |
1.Added set_called_app_name() and get_called_app_name() to identify called app function 2.Added log entry to identify uses and apps as unkonown if system could not identify them |
__construct()
This is where all models and library files are loaded
Constructor function
createDropdown(array $data = false)
createDropdown is the component function. Its main functionality is to produce a dropdown with pre populated table data
Parameter list :-
$data['selectByValue'] => null - preselection of list items by value
$data['selectBYText'] => null - preselection of list items by Text
$data['filterBy'] => null - filter data set by a field or list
$data['outFormat'] => 'html' - Format of the output like HTML,XML Etc
$data['isMultiple'] => false - is the drop down with multi select capable
$data['sort'] => 'asc' - sort list text Ascending or Descending
$data['optionsOnly'] => false - Specify the controller that output only
Usage :-
1) Format for internal functional call by passing data array
$data = array('selectByValue' => null, 'selectBYText' => null, 'outFormat' => 'html' , 'isMultiple' => false, 'sort' => 'asc', 'optionsOnly' => false, 'filterBy' => array( 'search_field' => 'T.status', 'search_text' => '0', 'query_method'=>'equal', 'order_by' => 'asc' ) )
2) Format of external call by URL
Description of parameter list,
sbv - selectByValue => null sbt - selectBYText => null format - outFormat => 'html' multiple - isMultiple=> false sort - sort => 'asc' filterby - filterBy => null optionsOnly - options only listing
array
data array to create dropdown
generateToken(\boolion $debug = false) : string
This function generats token as per request. The token consists of following values $token = "$calling_app_id-$called_app_id-$hostIp-$userId-$called_app_function_id-$timeStamp" * This then be encripted and sent out
\boolion
string
$enctoken
get_called_app_function_id() : \unknown
This function returns called app function id
\unknown
get_called_app_name()
This function gets called app name from calling app name property
return string calling app name
get_calling_app_name()
This function gets calling app name from calling app name property
return string calling app name
get_jason(integer $calling_app_id, integer $called_app_role_id, integer $calling_app_user_id)
This function echos json string from uaacs feed for given appid,app role,and calling app user id
integer
integer
integer
get_uaacs_feed_by_app_id(integer $app_id, string $app_type, \boolien $debug = false)
This function gets UAACS feed for a given app id from UAACS and return for further check ups
integer
string
\boolien
get_user_ip() : string
This function return user ip
http://stackoverflow.com/questions/15699101/get-the-client-ip-address-using-php
string
user ip
get_user_role_function_data(object $uaacs_feed, integer $calling_app_user_id, boolean $debug = false) : array|boolean
This function processes UAACS feed object and returns user role/assigned function array on success. Otherwise return fals
object
integer
boolean
array|boolean
getAppId()
This function returns app id
return int
getHostIP() : string
This function returns remote address
string
remote address
getRandomString()
This function returns a random string
return string
getTimeStamp() : string
This function returns date and only hrs value. It can include minits and seconds. but for the timebeing made available only hrs value along with date
string
date
getUserId()
This function returns calling app user id
return int calling app user id
issueToken(integer $integration_id, integer $calling_app_id, integer $called_app_id, integer $calling_app_user_id, integer $calling_app_func_id, boolean $debug = false) : \token
This function accepts above parameters then verify url call and given values. It first performs remote host ip address then performs application id check Based on given values this function then obtains uaacs data feed from UAACS application then store it in local database.Then proceed to generate token process.After obtaining the token then outputs an xml feed.
updated |
: Added codes to identify users and applications. If could not do so then to add log as unkonwn user and unkonwn application MRMR |
---|---|
update |
on: 28/04/2016 ex: http://localhost/app_registrar/index.php/AppRegistrar/issueToken/109/91/239/241 |
access |
public |
since | |
modified |
Jun 17, 2016 by Roshan Ruzaik mrmroshan@yahoo.com |
modification |
Fixed bug id 21885,21446 |
integer
integer
integer
integer
integer
boolean
\token
prepare_called_app_url(\boolion $debug = false) : string
This function prepares called app url which was supplied at integrating the app via share_function.xml file
\boolion
string
set_called_app_name(object $app_feed)
This function sets called app name property after xpathing UAACS xml feed
object
set_calling_app_name(object $app_feed, integer $app_id = null)
This function sets calling app name property after xpathing UAACS xml feed
object
integer
validate_app(integer $app_id, string $app_type, boolean $debug = false) : boolean
This function checks for validity of calling or called applications when a token request or token verification call is made
integer
string
boolean
boolean
validate_remote_host(string $debug = false) : boolean
This function checks validity of remote host when a token is request or token verification call is made
string
boolean
verify_role(string $token, integer $user_id, integer $role_id) : \number
This function verifies user role for a given user id.
string
integer
integer
\number
verify_token(string $debug = false) : void
access |
public |
---|---|
since | |
modified |
Jun 17, 2016 by Roshan Ruzaik mrmroshan@yahoo.com |
modification |
Fixed bug id 21527,20497,21455 |
string
verify_user_access(integer $user_id, integer $app_id, string $app_type, boolean $debug = false) : integer
This function cross checks with UAACS object for permissions with given user id and application id then return true/false
integer
integer
string
boolean
integer
view_log()
This function is to use as a debug message displayer
debug : \boolien
var |
---|
\boolien
progress : string
var |
---|
string
calling_app_id : integer
var |
---|
integer
calling_app_name : string
var |
---|
string
called_app_name : string
var |
---|
string
calling_app_user_id : integer
var |
---|
integer
called_app_role_id : integer
var |
---|
integer
calling_app_access_key : string
var |
---|
string
calling_app_security_key : string
var |
---|
string
calling_app_host : string
var |
---|
string
calling_app_func_id : integer
var |
---|
integer
integration_id : integer
var |
---|
integer
called_app_id : integer
var |
---|
integer
called_app_access_key : string
var |
---|
string
called_app_security_key : string
var |
---|
string
appIntRegResult : object
var |
---|
object
url : string
var |
---|
string
jason_data : string
var |
---|
string
tr_host : string
var |
---|
string
log_obj : object
var |
---|
object