diff --git a/ajax.php b/ajax.php index f9edbb55..750dee0b 100644 --- a/ajax.php +++ b/ajax.php @@ -57,6 +57,7 @@ $request = DevblocksPlatform::readRequest(); DevblocksPlatform::init(); +DevblocksPlatform::setExtensionDelegate('C4_DevblocksExtensionDelegate'); $session = DevblocksPlatform::getSessionService(); $settings = CerberusSettings::getInstance(); diff --git a/api/Application.class.php b/api/Application.class.php index b386daac..b746eda8 100644 --- a/api/Application.class.php +++ b/api/Application.class.php @@ -48,7 +48,7 @@ * and Joe Geck. * WEBGROUP MEDIA LLC. - Developers of Cerberus Helpdesk */ -define("APP_BUILD", 872); +define("APP_BUILD", 873); define("APP_MAIL_PATH", realpath(APP_PATH . '/storage/mail') . DIRECTORY_SEPARATOR); include_once(APP_PATH . "/api/DAO.class.php"); @@ -604,8 +604,8 @@ public static function getInstance() { return $license; } - public static function validate($key) { - /* */foreach(array('L0NvbXBhbnk6ICguKikv'=>'b','L0VtYWlsOiAoLiopLw=='=>'c','L1VzZXJzOiAoLiopLw=='=>'d','L1NlcmlhbDogKC4qKS8='=>'s') as $k=>$v)@preg_match(base64_decode($k),$key,$matches)?@$$v=trim($matches[1]):null;@$r=array('name'=>$b,'email'=>$c,'users'=>intval($d),'serial'=>$s);foreach(array(chr(97)=>0,chr(101)=>3) as $k=>$v)if(@substr(str_replace('-','',$s),0,1).@substr(str_replace('-','',$s),4,1).@substr(str_replace('-','',$s),8,1)==@substr(strtoupper(md5(@substr($b,0,1).@substr($b,-1,1).@strlen($b).$d.@substr($c,0,1).@substr($c,-1,1).@strlen($c))),$v,3))@$r[$k]=$s;return $r;/* + public static function validate($key, $email) { + /* */foreach(array('L0NvbXBhbnk6ICguKikv'=>'b','L1VzZXJzOiAoLiopLw=='=>'d','L1NlcmlhbDogKC4qKS8='=>'s') as $k=>$v)@preg_match(base64_decode($k),$key,$matches)?@$$v=trim($matches[1]):null;@$r=array('name'=>$b,'email'=>$email,'users'=>intval($d),'serial'=>$s);foreach(array(chr(97)=>0,chr(101)=>3) as $k=>$v)if(@substr(str_replace('-','',$s),0,1).@substr(str_replace('-','',$s),4,1).@substr(str_replace('-','',$s),8,1)==@substr(strtoupper(md5(@substr($b,0,1).@substr($b,-1,1).@strlen($b).$d.@substr($email,0,1).@substr($email,4,1).@strlen($email))),$v,3))@$r[$k]=$s;return $r;/* * we're sure being generous here! [TODO] */ $lines = split("\n", $key); @@ -617,9 +617,9 @@ public static function validate($key) { return (!empty($key)) ? array( 'name' => (list($k,$v)=split(":",$lines[1]))?trim($v):null, - 'email' => (list($k,$v)=split(":",$lines[2]))?trim($v):null, - 'users' => (list($k,$v)=split(":",$lines[3]))?trim($v):null, - 'serial' => (list($k,$v)=split(":",$lines[4]))?trim($v):null, + 'email' => $email, + 'users' => (list($k,$v)=split(":",$lines[2]))?trim($v):null, + 'serial' => (list($k,$v)=split(":",$lines[3]))?trim($v):null, 'date' => time() ) : null; @@ -722,3 +722,20 @@ public function get($key,$default=null) { return $default; } }; + +// [TODO] This gets called a lot when it happens after the registry cache +class C4_DevblocksExtensionDelegate implements DevblocksExtensionDelegate { + static function shouldLoadExtension(DevblocksExtensionManifest $extension_manifest) { + // Always allow core + if("cerberusweb.core" == $extension_manifest->plugin_id) + return true; + + // [TODO] This should limit to just things we can run with no session + // Community Tools, Cron/Update. They are still limited by their own + // isVisible() otherwise. + if(null == ($active_worker = CerberusApplication::getActiveWorker())) + return true; + + return $active_worker->hasPriv('plugin.'.$extension_manifest->plugin_id); + } +}; diff --git a/api/DAO.class.php b/api/DAO.class.php index 2e157368..b94bffab 100644 --- a/api/DAO.class.php +++ b/api/DAO.class.php @@ -897,17 +897,19 @@ static function setRolePrivileges($role_id, $privileges) { // Set ACLs according to the new master list if(!empty($privileges) && !empty($acl)) { - foreach($acl as $priv) { /* @var $priv DevblocksAclPrivilege */ + foreach($privileges as $priv) { /* @var $priv DevblocksAclPrivilege */ $sql = sprintf("INSERT INTO worker_role_acl (role_id, priv_id, has_priv) ". "VALUES (%d, %s, %d)", $role_id, - $db->qstr($priv->id), - (false !== array_search($priv->id,$privileges) ? 1 : 0) + $db->qstr($priv), + 1 ); $db->Execute($sql); } } + unset($privileges); + self::clearCache(); } diff --git a/index.php b/index.php index 0809ee5f..bd755e7c 100644 --- a/index.php +++ b/index.php @@ -68,6 +68,7 @@ require(APP_PATH . '/api/Application.class.php'); DevblocksPlatform::init(); +DevblocksPlatform::setExtensionDelegate('C4_DevblocksExtensionDelegate'); // Request $request = DevblocksPlatform::readRequest(); diff --git a/plugins/cerberusweb.calls/templates/calls/view.tpl b/plugins/cerberusweb.calls/templates/calls/view.tpl index fd0fd9d4..915247fe 100644 --- a/plugins/cerberusweb.calls/templates/calls/view.tpl +++ b/plugins/cerberusweb.calls/templates/calls/view.tpl @@ -6,9 +6,8 @@ {$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} | {$translate->_('common.refresh')|lower} - {* | *} diff --git a/plugins/cerberusweb.core/classes.php b/plugins/cerberusweb.core/classes.php index b11d051a..c53a0020 100644 --- a/plugins/cerberusweb.core/classes.php +++ b/plugins/cerberusweb.core/classes.php @@ -4220,6 +4220,7 @@ function saveLicensesAction() { } @$key = DevblocksPlatform::importGPC($_POST['key'],'string',''); + @$email = DevblocksPlatform::importGPC($_POST['email'],'string',''); @$do_delete = DevblocksPlatform::importGPC($_POST['do_delete'],'integer',0); if(DEMO_MODE) { @@ -4233,12 +4234,12 @@ function saveLicensesAction() { return; } - if(empty($key)) { + if(empty($key) || empty($email)) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config','settings','empty'))); return; } - if(null==($valid = CerberusLicense::validate($key)) || 5!=count($valid)) { + if(null==($valid = CerberusLicense::validate($key,$email)) || 5!=count($valid)) { DevblocksPlatform::setHttpResponse(new DevblocksHttpResponse(array('config','settings','invalid'))); return; } diff --git a/plugins/cerberusweb.core/plugin.xml b/plugins/cerberusweb.core/plugin.xml index cc1ccb16..51f8fcf4 100644 --- a/plugins/cerberusweb.core/plugin.xml +++ b/plugins/cerberusweb.core/plugin.xml @@ -82,7 +82,8 @@ - + + @@ -105,6 +106,9 @@ + + + @@ -115,6 +119,11 @@ + + + + + diff --git a/plugins/cerberusweb.core/strings.xml b/plugins/cerberusweb.core/strings.xml index 63ac901a..7f698d55 100644 --- a/plugins/cerberusweb.core/strings.xml +++ b/plugins/cerberusweb.core/strings.xml @@ -292,8 +292,11 @@ [Address Book] Can browse the address book - - [Address Book] Can export lists to CSV/XML + + [Address Book] Can export e-mail address lists to CSV/XML + + + [Address Book] Can export organization lists to CSV/XML @@ -316,6 +319,14 @@ [Display Ticket] Can split tickets + + + [Home] Can auto-refresh on the Home page + + + [Home] Can build private workspaces and worklists + + [Knowledgebase] Can view the knowledgebase @@ -343,6 +354,11 @@ [RSS] Can export lists as RSS feeds + + + [Tasks] Can export task lists to CSV/XML + + [Tickets] Can assign tickets to other workers @@ -371,9 +387,7 @@ [Tickets] Can use the pile sorter on lists - - - + diff --git a/plugins/cerberusweb.core/templates/activity/index.tpl b/plugins/cerberusweb.core/templates/activity/index.tpl index 2815b9e9..1c505031 100644 --- a/plugins/cerberusweb.core/templates/activity/index.tpl +++ b/plugins/cerberusweb.core/templates/activity/index.tpl @@ -11,13 +11,13 @@ var tabView = new YAHOO.widget.TabView(); {/literal} -{foreach from=$tab_manifests item=tab_manifest} +{foreach from=$tab_manifests item=tab_manifest} {literal}tabView.addTab( new YAHOO.widget.Tab({{/literal} label: '{$tab_manifest->params.title|devblocks_translate|escape:'quotes'}', dataSrc: '{devblocks_url}ajax.php?c=activity&a=showTab&ext_id={$tab_manifest->id}{/devblocks_url}', {if $tab_selected==$tab_manifest->params.uri}active: true,{/if} cacheData: false -{literal}}));{/literal} +{literal}}));{/literal} {/foreach} tabView.appendTo('activityOptions'); diff --git a/plugins/cerberusweb.core/templates/configuration/tabs/acl/edit_role.tpl b/plugins/cerberusweb.core/templates/configuration/tabs/acl/edit_role.tpl index 92c2051b..cbec43f6 100644 --- a/plugins/cerberusweb.core/templates/configuration/tabs/acl/edit_role.tpl +++ b/plugins/cerberusweb.core/templates/configuration/tabs/acl/edit_role.tpl @@ -45,22 +45,24 @@ {foreach from=$plugins item=plugin key=plugin_id} {if $plugin->enabled} - {assign var=show_plugin value=0} - {foreach from=$acl item=priv key=priv_id}{if $priv->plugin_id==$plugin_id}{assign var=show_plugin value=1}{/if}{/foreach} - - {if $show_plugin} + {assign var=plugin_priv value="plugin."|cat:$plugin_id}
- {$plugin->name}
- {$translate->_('check all')|lower} -
- {foreach from=$acl item=priv key=priv_id} - {if $priv->plugin_id==$plugin_id} -
- {/if} - {/foreach} -
-
+
+
+ {$translate->_('check all')|lower}
+ {foreach from=$acl item=priv key=priv_id} + {if $priv->plugin_id==$plugin_id} +
+ {/if} + {/foreach} +
+ {/if} {/foreach} diff --git a/plugins/cerberusweb.core/templates/configuration/tabs/settings/index.tpl b/plugins/cerberusweb.core/templates/configuration/tabs/settings/index.tpl index 14a40b79..c0a819fe 100644 --- a/plugins/cerberusweb.core/templates/configuration/tabs/settings/index.tpl +++ b/plugins/cerberusweb.core/templates/configuration/tabs/settings/index.tpl @@ -48,7 +48,7 @@ Data: {$total_db_data} MB
Indexes: {$total_db_indexes} MB
Total Disk Space: {$total_db_size} MB

-Running an OPTIMIZE on the database would free up about {$total_db_slack} MB
+Running an OPTIMIZE on the database would free about {$total_db_slack} MB

Attachments:

@@ -76,6 +76,12 @@ Total Disk Space: {$total_file_size} MB
Licensed to: {$license.name} + {if $license.email} + + E-mail: + {$license.email} + + {/if} Serial Number: {$license.serial} @@ -96,10 +102,15 @@ Total Disk Space: {$total_file_size} MB
+ +Enter the e-mail address from your order:
+
+
Paste the license information you received with your order:

-
+
+ diff --git a/plugins/cerberusweb.core/templates/configuration/tabs/workers/edit_worker.tpl b/plugins/cerberusweb.core/templates/configuration/tabs/workers/edit_worker.tpl index 615559d1..0fe7ca76 100644 --- a/plugins/cerberusweb.core/templates/configuration/tabs/workers/edit_worker.tpl +++ b/plugins/cerberusweb.core/templates/configuration/tabs/workers/edit_worker.tpl @@ -1,3 +1,4 @@ + {if ((empty($license) || empty($license.serial)) && count($workers) >= 3) || (!empty($license.serial)&&!empty($license.users)&&count($workers)>=$license.users)}{*Be good!*}{assign var=disabled value=1}{/if} @@ -15,28 +16,28 @@ First Name: - = 3} disabled{/if}> + Last Name: - = 3} disabled{/if}> + Title: - = 3} disabled{/if}> + E-mail: - = 3} disabled{/if}> + {if empty($worker->id)}Password:{else}Password:{/if} - = 3} disabled{/if}> + {if empty($worker->id)} (Leave blank to automatically e-mail a randomly-generated password.){/if} Password (again): - = 3} disabled{/if}> +   @@ -65,7 +66,7 @@ {foreach from=$teams item=team key=team_id} {assign var=member value=$workerTeams.$team_id} - @@ -85,7 +86,7 @@ Administrator {else} -
+
{/if}
@@ -96,7 +97,7 @@ - {if (empty($license) || empty($license.serial)) && count($workers) >= 3} + {if $disabled} {else} {if $active_worker->is_superuser && $active_worker->id != $worker->id}{/if} diff --git a/plugins/cerberusweb.core/templates/contacts/addresses/address_view.tpl b/plugins/cerberusweb.core/templates/contacts/addresses/address_view.tpl index b6075d56..0cb1294f 100644 --- a/plugins/cerberusweb.core/templates/contacts/addresses/address_view.tpl +++ b/plugins/cerberusweb.core/templates/contacts/addresses/address_view.tpl @@ -5,10 +5,9 @@ {$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} - {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} - {if $active_worker->is_superuser || $active_worker->can_export} | {$translate->_('common.export')|lower}{/if} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} + {if $active_worker->hasPriv('core.addybook.addy.view.actions.export')} | {$translate->_('common.export')|lower}{/if} | {$translate->_('common.refresh')|lower} diff --git a/plugins/cerberusweb.core/templates/contacts/orgs/contact_view.tpl b/plugins/cerberusweb.core/templates/contacts/orgs/contact_view.tpl index 379bca82..e690c47d 100644 --- a/plugins/cerberusweb.core/templates/contacts/orgs/contact_view.tpl +++ b/plugins/cerberusweb.core/templates/contacts/orgs/contact_view.tpl @@ -6,10 +6,9 @@ {$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} {$translate->_('common.refresh')|lower} - | {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} - {if $active_worker->is_superuser || $active_worker->can_export} | {$translate->_('common.export')|lower}{/if} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} + {if $active_worker->hasPriv('core.addybook.org.view.actions.export')} | {$translate->_('common.export')|lower}{/if} diff --git a/plugins/cerberusweb.core/templates/home/index.tpl b/plugins/cerberusweb.core/templates/home/index.tpl index ebf82b72..94136d98 100644 --- a/plugins/cerberusweb.core/templates/home/index.tpl +++ b/plugins/cerberusweb.core/templates/home/index.tpl @@ -4,8 +4,8 @@
- - -
+{/if} +

@@ -32,7 +32,7 @@ tabView.addTab( new YAHOO.widget.Tab({ })); {/literal} -{if empty($workspaces)} +{if empty($workspaces) && $active_worker->hasPriv('core.home.workspaces')} {literal} tabView.addTab( new YAHOO.widget.Tab({ label: '{/literal}{'home.tab.workspaces_intro'|devblocks_translate|escape:'quotes'}{literal}', @@ -51,7 +51,8 @@ tabView.addTab( new YAHOO.widget.Tab({ cacheData: false {literal}}));{/literal} {/foreach} - + +{if $active_worker->hasPriv('core.home.workspaces')} {foreach from=$workspaces item=workspace} {literal}tabView.addTab( new YAHOO.widget.Tab({{/literal} label: '{$workspace|escape}', @@ -59,7 +60,8 @@ tabView.addTab( new YAHOO.widget.Tab({ cacheData: false, active:{if substr($selected_tab,2)==$workspace}true{else}false{/if} {literal}}));{/literal} -{/foreach} +{/foreach} +{/if} tabView.appendTo('homeOptions'); diff --git a/plugins/cerberusweb.core/templates/tasks/view.tpl b/plugins/cerberusweb.core/templates/tasks/view.tpl index f5400ab2..57c9143e 100644 --- a/plugins/cerberusweb.core/templates/tasks/view.tpl +++ b/plugins/cerberusweb.core/templates/tasks/view.tpl @@ -5,8 +5,8 @@ {$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} - {if $active_worker->is_superuser || $active_worker->can_export} | {$translate->_('common.export')|lower}{/if} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} + {if $active_worker->hasPriv('core.tasks.view.actions.export')} | {$translate->_('common.export')|lower}{/if} | {$translate->_('common.refresh')|lower} {if $active_worker->hasPriv('core.rss')} | {/if} diff --git a/plugins/cerberusweb.core/templates/tickets/ticket_view.tpl b/plugins/cerberusweb.core/templates/tickets/ticket_view.tpl index 2cb8251f..45b519d9 100644 --- a/plugins/cerberusweb.core/templates/tickets/ticket_view.tpl +++ b/plugins/cerberusweb.core/templates/tickets/ticket_view.tpl @@ -10,7 +10,7 @@ {$translate->_('common.customize')|lower} {if $active_worker->hasPriv('core.ticket.view.actions.pile_sort')} | {$translate->_('mail.piles')|lower}{/if} {if $active_worker->hasPriv('core.mail.search')} | {$translate->_('common.search')|lower}{/if} - | {$translate->_('common.copy')|lower} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} {if $active_worker->hasPriv('core.ticket.view.actions.export')} | {$translate->_('common.export')|lower}{/if} | {$translate->_('common.refresh')|lower} {if $active_worker->hasPriv('core.rss')} | {/if} diff --git a/plugins/cerberusweb.crm/api/App.php b/plugins/cerberusweb.crm/api/App.php index 169ce79d..661f05af 100644 --- a/plugins/cerberusweb.crm/api/App.php +++ b/plugins/cerberusweb.crm/api/App.php @@ -289,12 +289,20 @@ function saveOppPanelAction() { // Save if($do_delete) { if(null != ($opp = DAO_CrmOpportunity::get($opp_id))) { - if($active_worker->is_superuser || $active_worker->id==$opp->worker_id) + + // Check privs + if(($active_worker->hasPriv('crm.opp.actions.create') && $active_worker->id==$opp->worker_id) + || ($active_worker->hasPriv('crm.opp.actions.update_nobody') && empty($opp->worker_id)) + || $active_worker->hasPriv('crm.opp.actions.update_all')) DAO_CrmOpportunity::delete($opp_id); } } elseif(empty($opp_id)) { $emails = DevblocksPlatform::parseCsvString($email_str); + + // Check privs + if(!$active_worker->hasPriv('crm.opp.actions.create')) + return; // One opportunity per provided e-mail address if(is_array($emails)) @@ -315,7 +323,11 @@ function saveOppPanelAction() { ); $opp_id = DAO_CrmOpportunity::create($fields); - // If we're adding a first comment + // Custom fields + @$field_ids = DevblocksPlatform::importGPC($_REQUEST['field_ids'], 'array', array()); + DAO_CustomFieldValue::handleFormPost(CrmCustomFieldSource_Opportunity::ID, $opp_id, $field_ids); + + // If we're adding a first comment if(!empty($comment)) { $fields = array( DAO_Note::CREATED => time(), @@ -324,14 +336,14 @@ function saveOppPanelAction() { DAO_Note::CONTENT => $comment, DAO_Note::WORKER_ID => $active_worker->id, ); - $comment_id = DAO_Note::create($fields); + $comment_id = DAO_Note::create($fields); } } } else { if(empty($opp_id)) return; - + $fields = array( DAO_CrmOpportunity::NAME => $name, DAO_CrmOpportunity::AMOUNT => $amount, @@ -341,16 +353,23 @@ function saveOppPanelAction() { DAO_CrmOpportunity::IS_CLOSED => $is_closed, DAO_CrmOpportunity::IS_WON => $is_won, DAO_CrmOpportunity::WORKER_ID => $worker_id, - ); - DAO_CrmOpportunity::update($opp_id, $fields); + ); + + // Check privs + if(null != ($opp = DAO_CrmOpportunity::get($opp_id)) + && ( + ($active_worker->hasPriv('crm.opp.actions.create') && $active_worker->id==$opp->worker_id) // owns + || ($active_worker->hasPriv('crm.opp.actions.update_nobody') && empty($opp->worker_id)) // can edit nobody + || $active_worker->hasPriv('crm.opp.actions.update_all')) // can edit anybody + ) { + DAO_CrmOpportunity::update($opp_id, $fields); + + // Custom fields + @$field_ids = DevblocksPlatform::importGPC($_REQUEST['field_ids'], 'array', array()); + DAO_CustomFieldValue::handleFormPost(CrmCustomFieldSource_Opportunity::ID, $opp_id, $field_ids); + } } - if(!$do_delete) { - // Custom fields - @$field_ids = DevblocksPlatform::importGPC($_REQUEST['field_ids'], 'array', array()); - DAO_CustomFieldValue::handleFormPost(CrmCustomFieldSource_Opportunity::ID, $opp_id, $field_ids); - } - // Reload view (if linked) if(!empty($view_id) && null != ($view = C4_AbstractViewLoader::getView('', $view_id))) { $view->render(); diff --git a/plugins/cerberusweb.crm/plugin.xml b/plugins/cerberusweb.crm/plugin.xml index 0eb68b9b..4f0e54dc 100644 --- a/plugins/cerberusweb.crm/plugin.xml +++ b/plugins/cerberusweb.crm/plugin.xml @@ -10,6 +10,13 @@ api/App.php CrmPlugin + + + + + + + diff --git a/plugins/cerberusweb.crm/strings.xml b/plugins/cerberusweb.crm/strings.xml index 7b728059..baa5ea5b 100644 --- a/plugins/cerberusweb.crm/strings.xml +++ b/plugins/cerberusweb.crm/strings.xml @@ -7,6 +7,21 @@ Opportunities + + + + + [Opportunities] Can create opportunities + + + [Opportunities] Can manage everyone's opportunities + + + [Opportunities] Can manage unassigned opportunities + + + [Opportunities] Can export opportunity lists to CSV/XML + diff --git a/plugins/cerberusweb.crm/templates/crm/opps/activity_tab/index.tpl b/plugins/cerberusweb.crm/templates/crm/opps/activity_tab/index.tpl index c90384f0..f754fe06 100644 --- a/plugins/cerberusweb.crm/templates/crm/opps/activity_tab/index.tpl +++ b/plugins/cerberusweb.crm/templates/crm/opps/activity_tab/index.tpl @@ -1,8 +1,10 @@ +{if $active_worker->hasPriv('crm.opp.actions.create')}
+{/if} diff --git a/plugins/cerberusweb.crm/templates/crm/opps/display/tabs/properties.tpl b/plugins/cerberusweb.crm/templates/crm/opps/display/tabs/properties.tpl index 5d42c4a9..d89a01f8 100644 --- a/plugins/cerberusweb.crm/templates/crm/opps/display/tabs/properties.tpl +++ b/plugins/cerberusweb.crm/templates/crm/opps/display/tabs/properties.tpl @@ -60,7 +60,13 @@ {include file="file:$core_tpl/internal/custom_fields/bulk/form.tpl" bulk=false}
+{if ($active_worker->hasPriv('crm.opp.actions.create') && $active_worker->id==$opp->worker_id) + || ($active_worker->hasPriv('crm.opp.actions.update_nobody') && empty($opp->worker_id)) + || $active_worker->hasPriv('crm.opp.actions.update_all')} +{else} +
You do not have permission to modify this record.
+{/if} \ No newline at end of file diff --git a/plugins/cerberusweb.crm/templates/crm/opps/org/tab.tpl b/plugins/cerberusweb.crm/templates/crm/opps/org/tab.tpl index 12d313db..d8840e52 100644 --- a/plugins/cerberusweb.crm/templates/crm/opps/org/tab.tpl +++ b/plugins/cerberusweb.crm/templates/crm/opps/org/tab.tpl @@ -1,6 +1,8 @@ +{if $active_worker->hasPriv('crm.opp.actions.create')} - + +{/if} {if !empty($view)}
diff --git a/plugins/cerberusweb.crm/templates/crm/opps/rpc/peek.tpl b/plugins/cerberusweb.crm/templates/crm/opps/rpc/peek.tpl index d7467f47..bc06ab07 100644 --- a/plugins/cerberusweb.crm/templates/crm/opps/rpc/peek.tpl +++ b/plugins/cerberusweb.crm/templates/crm/opps/rpc/peek.tpl @@ -94,13 +94,17 @@ {include file="file:$core_tpl/internal/custom_fields/bulk/form.tpl" bulk=false}
-
- - -{if !empty($opp) && ($active_worker->is_superuser || $active_worker->id == $opp->worker_id)} + +{if ($active_worker->hasPriv('crm.opp.actions.create') && (empty($opp) || $active_worker->id==$opp->worker_id)) + || ($active_worker->hasPriv('crm.opp.actions.update_nobody') && empty($opp->worker_id)) + || $active_worker->hasPriv('crm.opp.actions.update_all') + } + -{/if} - + +{else} +
You do not have permission to modify this record.
+{/if}
diff --git a/plugins/cerberusweb.crm/templates/crm/opps/ticket/tab.tpl b/plugins/cerberusweb.crm/templates/crm/opps/ticket/tab.tpl index 12a92932..09b30877 100644 --- a/plugins/cerberusweb.crm/templates/crm/opps/ticket/tab.tpl +++ b/plugins/cerberusweb.crm/templates/crm/opps/ticket/tab.tpl @@ -1,6 +1,8 @@ +{if $active_worker->hasPriv('crm.opp.actions.create')} - + +{/if} {if !empty($view)}
diff --git a/plugins/cerberusweb.crm/templates/crm/opps/view.tpl b/plugins/cerberusweb.crm/templates/crm/opps/view.tpl index 2c454255..3442fc1f 100644 --- a/plugins/cerberusweb.crm/templates/crm/opps/view.tpl +++ b/plugins/cerberusweb.crm/templates/crm/opps/view.tpl @@ -5,10 +5,9 @@
@@ -105,7 +104,7 @@ {if $total} {/if} diff --git a/plugins/cerberusweb.feedback/plugin.xml b/plugins/cerberusweb.feedback/plugin.xml index 12e034f2..9f530960 100644 --- a/plugins/cerberusweb.feedback/plugin.xml +++ b/plugins/cerberusweb.feedback/plugin.xml @@ -13,6 +13,8 @@ + + @@ -55,7 +57,7 @@ - + diff --git a/plugins/cerberusweb.feedback/strings.xml b/plugins/cerberusweb.feedback/strings.xml index 26218504..902d65f4 100644 --- a/plugins/cerberusweb.feedback/strings.xml +++ b/plugins/cerberusweb.feedback/strings.xml @@ -16,8 +16,14 @@ [Feedback] Can create feedback entries + + [Feedback] Can delete everyone's feedback entries + + + [Feedback] Can edit everyone's feedback entries + - [Feedback] Can export lists to CSV/XML + [Feedback] Can export feedback lists to CSV/XML @@ -51,7 +57,7 @@ Link - Worker + Created By diff --git a/plugins/cerberusweb.feedback/templates/feedback/ajax/feedback_entry_panel.tpl b/plugins/cerberusweb.feedback/templates/feedback/ajax/feedback_entry_panel.tpl index f2bbabd5..ab619004 100644 --- a/plugins/cerberusweb.feedback/templates/feedback/ajax/feedback_entry_panel.tpl +++ b/plugins/cerberusweb.feedback/templates/feedback/ajax/feedback_entry_panel.tpl @@ -39,7 +39,7 @@ {else} -{if $active_worker->is_superuser || $active_worker->id == $model->worker_id}{/if} +{if $active_worker->id == $model->worker_id || $active_worker->hasPriv('feedback.actions.delete_all')}{/if} {/if} \ No newline at end of file diff --git a/plugins/cerberusweb.feedback/templates/feedback/view.tpl b/plugins/cerberusweb.feedback/templates/feedback/view.tpl index 57fb042c..7fc19528 100644 --- a/plugins/cerberusweb.feedback/templates/feedback/view.tpl +++ b/plugins/cerberusweb.feedback/templates/feedback/view.tpl @@ -6,7 +6,7 @@ @@ -98,7 +98,7 @@
{$result.f_quote_text} - (edit) + {if ($active_worker->hasPriv('feedback.actions.create') && $result.f_worker_id==$active_worker->id) || $active_worker->hasPriv('feedback.actions.update_all')}(edit){/if}
@@ -110,7 +110,7 @@ {if $total} {/if} diff --git a/plugins/cerberusweb.forums/templates/forums/forums_view.tpl b/plugins/cerberusweb.forums/templates/forums/forums_view.tpl index e8c03aeb..d4cc65d1 100644 --- a/plugins/cerberusweb.forums/templates/forums/forums_view.tpl +++ b/plugins/cerberusweb.forums/templates/forums/forums_view.tpl @@ -5,9 +5,8 @@ diff --git a/plugins/cerberusweb.reports/plugin.xml b/plugins/cerberusweb.reports/plugin.xml index f5afd37c..802e5120 100644 --- a/plugins/cerberusweb.reports/plugin.xml +++ b/plugins/cerberusweb.reports/plugin.xml @@ -13,7 +13,9 @@ + @@ -43,7 +45,6 @@ - diff --git a/plugins/cerberusweb.reports/strings.xml b/plugins/cerberusweb.reports/strings.xml index ff4740cf..53e93f5b 100644 --- a/plugins/cerberusweb.reports/strings.xml +++ b/plugins/cerberusweb.reports/strings.xml @@ -13,9 +13,11 @@ + diff --git a/plugins/cerberusweb.timetracking/api/App.php b/plugins/cerberusweb.timetracking/api/App.php index e49dc537..bf403433 100644 --- a/plugins/cerberusweb.timetracking/api/App.php +++ b/plugins/cerberusweb.timetracking/api/App.php @@ -846,56 +846,6 @@ class Model_TimeTrackingActivity { public $rate; }; -//class ChTimeTrackingTab extends Extension_TicketTab { -// function showTab() { -// @$ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'],'integer',0); -// -// $tpl = DevblocksPlatform::getTemplateService(); -// $tpl_path = realpath(dirname(__FILE__).'/../templates') . DIRECTORY_SEPARATOR; -// $tpl->assign('path', $tpl_path); -// $tpl->cache_lifetime = "0"; -// -//// $ticket = DAO_Ticket::getTicket($ticket_id); -// $tpl->assign('ticket_id', $ticket_id); -// -//// if(null == ($view = C4_AbstractViewLoader::getView('', 'ticket_opps'))) { -//// $view = new C4_CrmOpportunityView(); -//// $view->id = 'ticket_opps'; -//// } -//// -//// if(!empty($address->contact_org_id)) { // org -//// @$org = DAO_ContactOrg::get($address->contact_org_id); -//// -//// $view->name = "Org: " . $org->name; -//// $view->params = array( -//// SearchFields_CrmOpportunity::ORG_ID => new DevblocksSearchCriteria(SearchFields_CrmOpportunity::ORG_ID,'=',$org->id) -//// ); -//// } -//// -//// C4_AbstractViewLoader::setView($view->id, $view); -//// -//// $tpl->assign('view', $view); -// -// $tpl->display('file:' . $tpl_path . 'timetracking/ticket_tab/index.tpl'); -// } -// -// function saveTab() { -// @$ticket_id = DevblocksPlatform::importGPC($_REQUEST['ticket_id'],'integer',0); -// -// $ticket = DAO_Ticket::getTicket($ticket_id); -// -// if(isset($_SESSION['timetracking'])) { -// @$time = intval($_SESSION['timetracking']); -//// echo "Ran for ", (time()-$time) , "secs
"; -// unset($_SESSION['timetracking']); -// } else { -// $_SESSION['timetracking'] = time(); -// } -// -// DevblocksPlatform::redirect(new DevblocksHttpResponse(array('display',$ticket->mask,'timetracking'))); -// } -//}; - class ChTimeTrackingEventListener extends DevblocksEventListenerExtension { function __construct($manifest) { parent::__construct($manifest); @@ -1175,10 +1125,10 @@ function saveEntryAction() { // Delete entries if(!empty($id) && !empty($do_delete)) { if(null != ($entry = DAO_TimeTrackingEntry::get($id))) { - // Only superusers and owners can delete entries - if($active_worker->is_superuser || $active_worker->id == $entry->worker_id) { - DAO_TimeTrackingEntry::delete($id); - } + // Check privs + if(($active_worker->hasPriv('timetracking.actions.create') && $active_worker->id==$entry->worker_id) + || $active_worker->hasPriv('timetracking.actions.update_all')) + DAO_TimeTrackingEntry::delete($id); } return; diff --git a/plugins/cerberusweb.timetracking/plugin.xml b/plugins/cerberusweb.timetracking/plugin.xml index 44c3afaf..2a05b637 100644 --- a/plugins/cerberusweb.timetracking/plugin.xml +++ b/plugins/cerberusweb.timetracking/plugin.xml @@ -11,6 +11,12 @@ ChTimeTrackingPlugin + + + + + + diff --git a/plugins/cerberusweb.timetracking/strings.xml b/plugins/cerberusweb.timetracking/strings.xml index 86f68584..37f2318e 100644 --- a/plugins/cerberusweb.timetracking/strings.xml +++ b/plugins/cerberusweb.timetracking/strings.xml @@ -13,6 +13,18 @@ Track Time + + + + + [Time Tracking] Can track time + + + [Time Tracking] Can manage everyone's time slips + + + [Time Tracking] Can export time tracking lists to CSV/XML + diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/logmail_toolbar_timer.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/logmail_toolbar_timer.tpl index ad927fa5..e9dbae1d 100644 --- a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/logmail_toolbar_timer.tpl +++ b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/logmail_toolbar_timer.tpl @@ -1 +1,3 @@ - \ No newline at end of file +{if $active_worker->hasPriv('timetracking.actions.create')} + +{/if} \ No newline at end of file diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/reply_toolbar_timer.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/reply_toolbar_timer.tpl index ad927fa5..e9dbae1d 100644 --- a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/reply_toolbar_timer.tpl +++ b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/reply_toolbar_timer.tpl @@ -1 +1,3 @@ - \ No newline at end of file +{if $active_worker->hasPriv('timetracking.actions.create')} + +{/if} \ No newline at end of file diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/sendmail_toolbar_timer.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/sendmail_toolbar_timer.tpl index ad927fa5..e9dbae1d 100644 --- a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/sendmail_toolbar_timer.tpl +++ b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/sendmail_toolbar_timer.tpl @@ -1 +1,3 @@ - \ No newline at end of file +{if $active_worker->hasPriv('timetracking.actions.create')} + +{/if} \ No newline at end of file diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/ticket_toolbar_timer.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/ticket_toolbar_timer.tpl index f0f3c80a..fd59106c 100644 --- a/plugins/cerberusweb.timetracking/templates/timetracking/renderers/ticket_toolbar_timer.tpl +++ b/plugins/cerberusweb.timetracking/templates/timetracking/renderers/ticket_toolbar_timer.tpl @@ -1 +1,3 @@ - \ No newline at end of file +{if $active_worker->hasPriv('timetracking.actions.create')} + +{/if} \ No newline at end of file diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/rpc/time_entry_panel.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/rpc/time_entry_panel.tpl index 02f19cae..f5903cae 100644 --- a/plugins/cerberusweb.timetracking/templates/timetracking/rpc/time_entry_panel.tpl +++ b/plugins/cerberusweb.timetracking/templates/timetracking/rpc/time_entry_panel.tpl @@ -61,14 +61,20 @@ {/if} - -{if empty($model->id)} - - - -{else} - -{if $active_worker->is_superuser || $active_worker->id == $model->worker_id}{/if} - + +{if ($active_worker->hasPriv('timetracking.actions.create') && (empty($model->id) || $active_worker->id==$model->worker_id)) + || $active_worker->hasPriv('timetracking.actions.update_all') + } + {if empty($model->id)} + + + + {else} + + + + {/if} +{else} +
You do not have permission to modify this record.
{/if} \ No newline at end of file diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/ticket_tab/index.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/ticket_tab/index.tpl deleted file mode 100644 index 85c371a7..00000000 --- a/plugins/cerberusweb.timetracking/templates/timetracking/ticket_tab/index.tpl +++ /dev/null @@ -1,9 +0,0 @@ -
- - - - - - - - diff --git a/plugins/cerberusweb.timetracking/templates/timetracking/time/view.tpl b/plugins/cerberusweb.timetracking/templates/timetracking/time/view.tpl index 414337c9..7890a48e 100644 --- a/plugins/cerberusweb.timetracking/templates/timetracking/time/view.tpl +++ b/plugins/cerberusweb.timetracking/templates/timetracking/time/view.tpl @@ -6,9 +6,8 @@
{$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} - {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} - {if $active_worker->is_superuser || $active_worker->can_export} | {$translate->_('common.export')|lower}{/if} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} + {if $active_worker->hasPriv('crm.opp.view.actions.export')} | {$translate->_('common.export')|lower}{/if} | {$translate->_('common.refresh')|lower}
- + {if $active_worker->hasPriv('crm.opp.actions.update_all')}{/if}
{$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} {if $active_worker->hasPriv('feedback.view.actions.export')} | {$translate->_('common.export')|lower}{/if} | {$translate->_('common.refresh')|lower}
- + {if $active_worker->hasPriv('feedback.actions.update_all')}{/if}
{$view->name} - {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} | {$translate->_('common.refresh')|lower}
{$view->name} {if $view->id == 'search'}{$translate->_('views.jump_to_actions')}{/if} {$translate->_('common.customize')|lower} - | {$translate->_('common.copy')|lower} - {* {if $view->id != 'search'} | {$translate->_('common.search')|lower} list{/if} *} - {if $active_worker->is_superuser || $active_worker->can_export} | {$translate->_('common.export')|lower}{/if} + {if $active_worker->hasPriv('core.home.workspaces')} | {$translate->_('common.copy')|lower}{/if} + {if $active_worker->hasPriv('timetracking.view.actions.export')} | {$translate->_('common.export')|lower}{/if} | {$translate->_('common.refresh')|lower}