| | |
| | | |
| | | use JVBase\blocks\CustomBlocks; |
| | | use JVBase\base\Site; |
| | | use JVBase\managers\ApprovalManager; |
| | | use JVBase\managers\EmailManager; |
| | | use JVBase\managers\ErrorHandler; |
| | | use JVBase\managers\FavouritesManager; |
| | | use JVBase\managers\InvitationsManager; |
| | | use JVBase\managers\LoginManager; |
| | | use JVBase\managers\MagicLinkManager; |
| | |
| | | $this->managers['notifications'] = new NotificationManager(); |
| | | $this->routes['notifications'] = new NotificationsRoutes(); |
| | | } |
| | | if (!empty(Registrar::getFeatured('approve_new'))) { |
| | | $this->managers['approvals'] = new ApprovalManager(); |
| | | } |
| | | if (Site::has('feed_block') || Site::has('dashboard')) { |
| | | $this->routes['term'] = new TermRoutes(); |
| | | } |
| | |
| | | } |
| | | |
| | | if (Site::has('favourites')) { |
| | | $this->managers['favourites'] = new FavouritesManager(); |
| | | $this->routes['favourites'] = new FavouritesRoutes(); |
| | | } |
| | | |
| | |
| | | |
| | | public function userCanConnect(string $service, int $userID): bool |
| | | { |
| | | $allowed = JVB_USER[jvbUserRole($userID)]['integrations'] ?? []; |
| | | return user_can($userID, 'manage_options') || in_array($service, $allowed); |
| | | $role = jvbUserRole($userID); |
| | | $registrar = Registrar::getInstance($role); |
| | | return user_can($userID, 'manage_options') || $registrar->hasIntegration($service); |
| | | } |
| | | |
| | | public function getAvailableServices(bool $keys = true): array |
| | |
| | | |
| | | if (!empty ($buttons)) { |
| | | ?> |
| | | <section class="additional-actions"> |
| | | <section class="main-actions"> |
| | | <div class="buttons col"> |
| | | <?= implode($buttons); ?> |
| | | </div> |
| | |
| | | { |
| | | return $this->managers['terms']; |
| | | } |
| | | |
| | | public function approvals ():ApprovalManager|false |
| | | { |
| | | return $this->managers['approvals']??false; |
| | | } |
| | | } |