Subversion Repositories SmartDukaan

Rev

Rev 15015 | Rev 15227 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 15015 Rev 15188
Line 78... Line 78...
78
				$this->Cookie->write('debuguser',1);
78
				$this->Cookie->write('debuguser',1);
79
			}else{
79
			}else{
80
				$this->Cookie->delete('debuguser');
80
				$this->Cookie->delete('debuguser');
81
			}
81
			}
82
		}
82
		}
-
 
83
		//acl
-
 
84
		$cachekey = 'acls';
-
 
85
		$acls = Cache::read($cachekey,'month');
-
 
86
		if(empty($acls)) {
-
 
87
			$acls = array();
-
 
88
			$this->loadModel('Acl');
-
 
89
			$result = $this->Acl->find('all');
-
 
90
			foreach ($result as $key => $value) {
-
 
91
				if($value['Acl']['access']) {
-
 
92
					$acls[$value['Acl']['group_id']]['allowed'][] = $value['Acl']['action'];
-
 
93
				}else{
-
 
94
					$acls[$value['Acl']['group_id']]['disallowed'][] = $value['Acl']['action'];
-
 
95
				}				
-
 
96
			}
-
 
97
			Cache::write($cachekey,$acls,'month');
-
 
98
		}
-
 
99
		$this->set('acls',$acls);
83
    }
100
    }
84
	
101
	
85
    function isAuthorized() {
102
    function isAuthorized() {
86
        return $this->Auth->user('id');
103
        return $this->Auth->user('id');
87
    }
104
    }
Line 112... Line 129...
112
 
129
 
113
    function checkToken() {
130
    function checkToken() {
114
		$headers =  $this->getallheaders();
131
		$headers =  $this->getallheaders();
115
        $this->log(print_r($headers,1),'headers');
132
        $this->log(print_r($headers,1),'headers');
116
        $token = $_COOKIE['token'];
133
        $token = $_COOKIE['token'];
-
 
134
        $checkToken = $_COOKIE['walletAuthentication'];
117
        $this->log("Token : $token",'headers');
135
        $this->log("Token : $token",'headers');
118
        // if(isset($headers['Token']) && !empty($headers['Token'])) {
136
        $this->log("CheckToken : $checkToken",'headers');
119
        if(isset($token) && !empty($token)) {
137
        if(isset($checkToken) && !empty($checkToken) && isset($token) && !empty($token)) {
120
        	$this->loadModel('SocialProfile');
138
        	$this->loadModel('SocialProfile');
121
        	$options = array('conditions'=>array('access_token'=>$token),'fields'=>array('user_id'),'recursive'=>-1);
139
        	$options = array('conditions'=>array('access_token'=>$token),'fields'=>array('user_id'),'recursive'=>-1);
122
        	$user = $this->SocialProfile->find('first',$options);
140
        	$user = $this->SocialProfile->find('first',$options);
123
        	$userId = $this->request->query('user_id');
141
        	$userId = $this->request->query('user_id');
124
			if(isset($userId) && !empty($userId)){
142
			if(isset($userId) && !empty($userId)){