<?php

namespace App\Common;

use App\Utility\Common;

class Permission extends CorePermission
{

    public static function isPermitted($controller_id = 0)
    {
        $result = false;
        $common = new Common();
        $user_type_name = $common->getCurrentUserInfo();
        if ($user_type_name == "MEMBER" || self::isEmployeeAsAdmin()) {
            $result = true;
        }
        return $result;
    }

    public static function isEmployeeAsAdmin(){
        $result = false;
        $common = new Common();
        $user_type_name = $common->getCurrentUserInfo();
        if ($user_type_name == "EMPLOYEE" && $_SESSION['Auth']['User']['is_admin_access'] == 1) {
            $result = true;
        }
        return $result;
    }

    public static function setPermissionForEmployee($controller_id)
    {
        unset($_SESSION['hasEpicVelocity']);
        if (self::isPermittedFromSessionByControllerId($controller_id) && $_SESSION['has_epic_for_employee']) {
            $_SESSION['hasEpicVelocity'] = true;
        }
    }




}