Skip to content

Commit

Permalink
Merge pull request #1564 from somechris/python-priv-drop
Browse files Browse the repository at this point in the history
bindings/python: Add priv_drop_user and priv_drop_group
  • Loading branch information
hzeller authored Jul 30, 2024
2 parents f7bcb9d + a18883c commit b0508fc
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 0 deletions.
2 changes: 2 additions & 0 deletions bindings/python/rgbmatrix/core.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@ cdef class RGBMatrixOptions:
cdef bytes __py_encoded_led_rgb_sequence
cdef bytes __py_encoded_pixel_mapper_config
cdef bytes __py_encoded_panel_type
cdef bytes __py_encoded_drop_priv_user
cdef bytes __py_encoded_drop_priv_group

# Local Variables:
# mode: python
Expand Down
12 changes: 12 additions & 0 deletions bindings/python/rgbmatrix/core.pyx
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,18 @@ cdef class RGBMatrixOptions:
def __get__(self): return self.__runtime_options.drop_privileges
def __set__(self, uint8_t value): self.__runtime_options.drop_privileges = value

property drop_priv_user:
def __get__(self): return self.__runtime_options.drop_priv_user
def __set__(self, value):
self.__py_encoded_drop_priv_user = value.encode('utf-8')
self.__runtime_options.drop_priv_user = self.__py_encoded_drop_priv_user

property drop_priv_group:
def __get__(self): return self.__runtime_options.drop_priv_group
def __set__(self, value):
self.__py_encoded_drop_priv_group = value.encode('utf-8')
self.__runtime_options.drop_priv_group = self.__py_encoded_drop_priv_group

cdef class RGBMatrix(Canvas):
def __cinit__(self, int rows = 0, int chains = 0, int parallel = 0,
RGBMatrixOptions options = None):
Expand Down
2 changes: 2 additions & 0 deletions bindings/python/rgbmatrix/cppinc.pxd
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,8 @@ cdef extern from "led-matrix.h" namespace "rgb_matrix":
int gpio_slowdown
int daemon
int drop_privileges
const char *drop_priv_user
const char *drop_priv_group


RGBMatrix *CreateMatrixFromOptions(Options &options, RuntimeOptions runtime_options)
Expand Down

0 comments on commit b0508fc

Please sign in to comment.