backend/app/Project.php
/**
     * Authorization check
     * 
     * @param int $projectId Project id
     * @return boolean
     */
Authorization check

@param int $projectId Project id
@return boolean
Authorization check @param int $projectId Project id @return boolean
public static function userHasAccess($projectId)
    {
        if (strpos(env('ANONYMOUS_ACCESS_IP'), $_SERVER['REMOTE_ADDR']) !== false) {
            return true;
        }
        if (!Auth::user()) {
            return false;
        }
        $userProjects = Auth::user()->organization->projects;
        foreach ($userProjects as $up) {
            if ($up->id == $projectId) {
                return true;
            }
        }
            $userProjects = Auth::user()->organization->projects;
            foreach ($userProjects as $up) {
                if ($up->id == $projectId) {
                    return true;
                }
            }
        return false;
    }
public static function userHasAccess ( $ projectId ) { if ( strpos ( env ( 'ANONYMOUS_ACCESS_IP' ) , $ _SERVER [ 'REMOTE_ADDR' ] ) !== false ) { return true ; } if ( ! Auth :: user ( ) ) { return false ; } $ userProjects = Auth :: user ( ) -> organization -> projects ; foreach ( $ userProjects as $ up ) { if ( $ up -> id == $ projectId ) { return true ; } } $ userProjects = Auth :: user ( ) -> organization -> projects ; foreach ( $ userProjects as $ up ) { if ( $ up -> id == $ projectId ) { return true ; } } return false ; }
Authorization check
Authorization check