| @@ -58,23 +58,33 @@ | ||
| 58 | 58 | */ |
| 59 | 59 | public function getCommitter() |
| 60 | 60 | { |
| 61 | 61 | if ($this->committer === null) { |
| 62 | - // fetch client section | |
| 63 | - $isSite = JFactory::getApplication()->isClient('site'); | |
| 62 | + /** | |
| 63 | + * Check whether the user completed the authentication via APP. | |
| 64 | + * | |
| 65 | + * @since 1.18.16 (J) - 1.8.16 (WP) | |
| 66 | + */ | |
| 67 | + if (class_exists('VCMAppFramework') && ($appUser = VCMAppFramework::getUser())) { | |
| 68 | + $user = (object) $appUser; | |
| 69 | + $role = $appUser['admin'] ? 'admin' : 'operator'; | |
| 70 | + } else { | |
| 71 | + // fetch client section | |
| 72 | + $isSite = JFactory::getApplication()->isClient('site'); | |
| 64 | 73 | |
| 65 | - // check if the user is an operator | |
| 66 | - $operator = $isSite ? VikBooking::getOperatorInstance()->getOperatorAccount() : null; | |
| 74 | + // check if the user is an operator | |
| 75 | + $operator = $isSite ? VikBooking::getOperatorInstance()->getOperatorAccount() : null; | |
| 67 | 76 | |
| 68 | - if ($operator) { | |
| 69 | - // user logged in as operator | |
| 70 | - $user = (object) $operator; | |
| 71 | - $user->name = trim($user->first_name . ' ' . $user->last_name); | |
| 72 | - $role = 'operator'; | |
| 73 | - } else { | |
| 74 | - // CMS user | |
| 75 | - $user = JFactory::getUser(); | |
| 76 | - $role = $isSite ? 'guest' : 'admin'; | |
| 77 | + if ($operator) { | |
| 78 | + // user logged in as operator | |
| 79 | + $user = (object) $operator; | |
| 80 | + $user->name = trim($user->first_name . ' ' . $user->last_name); | |
| 81 | + $role = 'operator'; | |
| 82 | + } else { | |
| 83 | + // CMS user | |
| 84 | + $user = JFactory::getUser(); | |
| 85 | + $role = $isSite ? 'guest' : 'admin'; | |
| 86 | + } | |
| 77 | 87 | } |
| 78 | 88 | |
| 79 | 89 | // instantiate committer only once |
| 80 | 90 | $this->committer = new VBOHistoryCommitter($user->id, $user->name, $role); |