Scalr_Account_User::isSubjectLead PHP Method

isSubjectLead() public method

Checks if user has access to project or cost center
public isSubjectLead ( string $projectId = null, string $ccId = null ) : boolean
$projectId string optional Id of the project
$ccId string optional Id of the cost center
return boolean Returns false if user is not lead of the subject
    public function isSubjectLead($projectId = null, $ccId = null)
    {
        if (!empty($projectId)) {
            $project = ProjectEntity::findPk($projectId);
            if (empty($project) || $project->getProperty(ProjectPropertyEntity::NAME_LEAD_EMAIL) !== $this->getEmail()) {
                return false;
            }
        } else {
            if (!empty($ccId)) {
                $ccs = CostCentreEntity::findPk($ccId);
                if (empty($ccs) || $ccs->getProperty(CostCentrePropertyEntity::NAME_LEAD_EMAIL) !== $this->getEmail()) {
                    return false;
                }
            }
        }
        return true;
    }