public function getPrincipal($markerSiteId) { $user = Session::get(user); $auth = Authorization::whereRaw('token = ? and atlas_id = ? and privileges = \'ALL\'', array($user->uid, $markerSiteId))->first(); if ($user->role == 'ADMIN' && $auth == NULL) { $auth = Authorization::create(array('token' => $user->uid, 'principal' => 'admin:' . $user->uid, 'privileges' => 'ADMIN')); } Log::debug("Privileges: " . $auth->principal . "/" . $auth->privileges); return $auth->principal; }