Skip to content

Instantly share code, notes, and snippets.

@jwhitcraft
Created February 14, 2012 18:11
Show Gist options
  • Save jwhitcraft/1828709 to your computer and use it in GitHub Desktop.
Save jwhitcraft/1828709 to your computer and use it in GitHub Desktop.
<?php
/**
* Custom Controller for LeadRouting Module to provide access
*/
class Customsgr_LeadRoutingController extends SugarController
{
/**
* Overwrite the preProcess() method to determin if access can be granted to this module
*
* @return null;
*/
public function preProcess()
{
global $current_user;
// is user an admin?
$isAdmin = is_admin($current_user);
// are they in a specific role?
$role_check = $current_user->check_role_membership('Sales Operations');
$role_check1 = $current_user->check_role_membership('Sales Manager');
// they can access if any of the following are true otherwise no access!
if($isAdmin || $role_check || $role_check1) {
$this->hasAccess = true;
} else {
$this->hasAccess = false;
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment