Exemple #1
0
 function getRoleAction()
 {
     $translate = DevblocksPlatform::getTranslationService();
     $worker = UsermeetApplication::getActiveWorker();
     if (!$worker || !$worker->is_superuser) {
         echo $translate->_('common.access_denied');
         return;
     }
     @($id = DevblocksPlatform::importGPC($_REQUEST['id']));
     $tpl = DevblocksPlatform::getTemplateService();
     $tpl->assign('path', $this->_TPL_PATH);
     $plugins = DevblocksPlatform::getPluginRegistry();
     $tpl->assign('plugins', $plugins);
     $acl = DevblocksPlatform::getAclRegistry();
     $tpl->assign('acl', $acl);
     $workers = DAO_Worker::getAllActive();
     $tpl->assign('workers', $workers);
     $role = DAO_WorkerRole::get($id);
     $tpl->assign('role', $role);
     $role_privs = DAO_WorkerRole::getRolePrivileges($id);
     $tpl->assign('role_privs', $role_privs);
     $role_roster = DAO_WorkerRole::getRoleWorkers($id);
     $tpl->assign('role_workers', $role_roster);
     $tpl->assign('license', UsermeetLicense::getInstance());
     $tpl->display('file:' . $this->_TPL_PATH . 'setup/tabs/acl/edit_role.tpl');
 }
Exemple #2
0
 function hasPriv($priv_id)
 {
     // We don't need to do much work if we're a superuser
     if ($this->is_superuser) {
         return true;
     }
     $settings = DevblocksPlatform::getPluginSettingsService();
     $acl_enabled = $settings->get('usermeet.core', UsermeetSettings::ACL_ENABLED);
     // ACL is a paid feature (please respect the licensing and support the project!)
     $license = UsermeetLicense::getInstance();
     if (!$acl_enabled || !isset($license['serial']) || isset($license['a'])) {
         return "core.setup" == substr($priv_id, 0, 11) ? false : true;
     }
     // Check the aggregated worker privs from roles
     $acl = DAO_WorkerRole::getACL();
     $privs_by_worker = $acl[DAO_WorkerRole::CACHE_KEY_PRIVS_BY_WORKER];
     if (!empty($priv_id) && isset($privs_by_worker[$this->id][$priv_id])) {
         return true;
     }
     return false;
 }
Exemple #3
0
 public function writeResponse(DevblocksHttpResponse $response)
 {
     $path = $response->path;
     // [JAS]: Ajax? // [TODO] Explore outputting whitespace here for Safari
     //	    if(empty($path))
     //			return;
     $tpl = DevblocksPlatform::getTemplateService();
     $session = DevblocksPlatform::getSessionService();
     $settings = DevblocksPlatform::getPluginSettingsService();
     $translate = DevblocksPlatform::getTranslationService();
     $active_worker = UsermeetApplication::getActiveWorker();
     $visit = $session->getVisit();
     $page_manifests = $this->_getAllowedPages();
     $controller = array_shift($path);
     // Default page [TODO] This is supposed to come from framework.config.php
     if (empty($controller)) {
         $controller = 'home';
     }
     // [JAS]: Require us to always be logged in for Usermeet pages
     if (empty($visit) && 0 != strcasecmp($controller, 'login')) {
         $query = array();
         if (!empty($response->path)) {
             $query = array('url' => urlencode(implode('/', $response->path)));
         }
         DevblocksPlatform::redirect(new DevblocksHttpRequest(array('login'), $query));
     }
     $page_id = $this->_getPageIdByUri($controller);
     @($page = DevblocksPlatform::getExtension($page_id, true));
     /* @var $page UsermeetPageExtension */
     if (empty($page)) {
         header("Status: 404");
         return;
         // [TODO] 404
     }
     // [JAS]: Listeners (Step-by-step guided tour, etc.)
     $listenerManifests = DevblocksPlatform::getExtensions('devblocks.listener.http');
     foreach ($listenerManifests as $listenerManifest) {
         /* @var $listenerManifest DevblocksExtensionManifest */
         $inst = $listenerManifest->createInstance();
         /* @var $inst DevblocksHttpRequestListenerExtension */
         $inst->run($response, $tpl);
     }
     $tpl->assign('active_worker', $active_worker);
     $tour_enabled = false;
     if (!empty($visit) && !is_null($active_worker)) {
         $tour_enabled = intval(DAO_WorkerPref::get($active_worker->id, 'assist_mode', 1));
         $keyboard_shortcuts = intval(DAO_WorkerPref::get($active_worker->id, 'keyboard_shortcuts', 1));
         $tpl->assign('pref_keyboard_shortcuts', $keyboard_shortcuts);
         //	    	$active_worker_memberships = $active_worker->getMemberships();
         //	    	$tpl->assign('active_worker_memberships', $active_worker_memberships);
         $unread_notifications = DAO_WorkerEvent::getUnreadCountByWorker($active_worker->id);
         $tpl->assign('active_worker_notify_count', $unread_notifications);
         DAO_Worker::logActivity($active_worker->id, $page->getActivity());
     }
     $tpl->assign('tour_enabled', $tour_enabled);
     // [JAS]: Variables provided to all page templates
     $tpl->assign('settings', $settings);
     $tpl->assign('session', $_SESSION);
     $tpl->assign('translate', $translate);
     $tpl->assign('visit', $visit);
     $tpl->assign('license', UsermeetLicense::getInstance());
     $tpl->assign('page_manifests', $page_manifests);
     $tpl->assign('page', $page);
     $tpl->assign('response_uri', implode('/', $response->path));
     $core_tpl = APP_PATH . '/features/usermeet.core/templates/';
     $tpl->assign('core_tpl', $core_tpl);
     // Prebody Renderers
     $preBodyRenderers = DevblocksPlatform::getExtensions('usermeet.renderer.prebody', true);
     if (!empty($preBodyRenderers)) {
         $tpl->assign('prebody_renderers', $preBodyRenderers);
     }
     // Postbody Renderers
     $postBodyRenderers = DevblocksPlatform::getExtensions('usermeet.renderer.postbody', true);
     if (!empty($postBodyRenderers)) {
         $tpl->assign('postbody_renderers', $postBodyRenderers);
     }
     // Timings
     $tpl->assign('render_time', microtime(true) - DevblocksPlatform::getStartTime());
     if (function_exists('memory_get_usage') && function_exists('memory_get_peak_usage')) {
         $tpl->assign('render_memory', memory_get_usage() - DevblocksPlatform::getStartMemory());
         $tpl->assign('render_peak_memory', memory_get_peak_usage() - DevblocksPlatform::getStartPeakMemory());
     }
     $tpl->display($core_tpl . 'border.tpl');
     //		$cache = DevblocksPlatform::getCacheService();
     //		$cache->printStatistics();
 }