public static function getFromString($perm)
    {
        list ($app, $code) = explode('.', trim($perm));
        $sql = new Pluf_SQL('code_name=%s AND application=%s', array(
            $code,
            $app
        ));
        $permModel = new User_Role();
        $perms = $permModel->getList(array(
            'filter' => $sql->gen()
        ));
        if ($perms->count() != 1) { // permission does not exist
            if(Pluf::f('core_permession_autoCreate', true)){
                $permModel->code_name = $code;
                $permModel->application = $app;
                if($permModel->create()){
                    return $permModel;
                }
            }
            return false;
        }
        return $perms[0];
    }