Created
February 14, 2012 18:11
-
-
Save jwhitcraft/1828709 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?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