Skip to content

Commit

Permalink
Only use .nonadmin files for privilege elevation logic
Browse files Browse the repository at this point in the history
  • Loading branch information
marcoesters committed Oct 9, 2024
1 parent b2d278e commit efc5afc
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions menuinst/_legacy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
import json
import logging
import sys
from os.path import abspath, basename
from os.path import abspath, basename, exists, join

try:
from .._version import __version__
except ImportError:
__version__ = "dev"

from ..utils import DEFAULT_BASE_PREFIX, DEFAULT_PREFIX, needs_admin, python_executable
from ..utils import DEFAULT_BASE_PREFIX, DEFAULT_PREFIX, python_executable

if sys.platform == 'win32':
from ..platforms.win_utils.win_elevate import isUserAdmin, runAsAdmin
Expand Down Expand Up @@ -59,7 +59,7 @@ def install(path, remove=False, prefix=None, recursing=False, root_prefix=None):
if not sys.platform == 'win32':
raise RuntimeError("menuinst._legacy is only supported on Windows.")

if needs_admin(prefix, root_prefix):
if exists(join(prefix, ".nonadmin")) or exists(join(root_prefix, ".nonadmin")):
if isUserAdmin():
_install(path, remove, prefix, mode='system', root_prefix=root_prefix)
else:
Expand Down
2 changes: 1 addition & 1 deletion news/260-backport-v2-admin-to-v1
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
### Enhancements

* Backport privilege elevation logic from v2 to v1. (#260)
* Partially backport privilege elevation logic from v2 to v1. (#260)

### Bug fixes

Expand Down

0 comments on commit efc5afc

Please sign in to comment.