Сравнение версий

Ключ

  • Эта строка добавлена.
  • Эта строка удалена.
  • Изменено форматирование.

...

  • message – строка, которая будет выведена в системный журнал.
    Для формирования строки message могут использоваться объекты action и subject (см. описание ниже).

    Например, при использовании метода "polkit.log("этот текст будет выведен в системный журнал");", в журнале появится запись:
    Блок кода
    окт 22 03:47:18 astra-28739 polkitd[18387]: этот текст будет выведен в системный журнал

Объект: action

Объект содержит информацию Внутрь функции function(action, subject) передаётся параметр action,  который является объектом с информацией о действии, относительного которого проводится проверка: разрешено или нет это действие пользователю.

Объект поддерживает один атрибут:

...

Блок кода
окт 22 00:55:27 astra-28739 polkitd[18387]: action=[Action id='org.freedesktop.policykit.exec' program='/usr/bin/echo' user.display='administrator' command_line='/usr/bin/echo 33333' user='administrator' polkit.message='Authentication is needed to run `$(program)' as user $(user.display)' polkit.gettext_domain='polkit-1' user.gecos='']

Объект: subject

Внутрь функции function(action, subject) передаётся параметр subject,  который является объектом с информацией о процессе (пользователе) чьи права проверяются.

Объект поддерживает атрибуты:

int pid

The process id.

string user

The user name.

string[] groups

Array of groups that user user belongs to.

string seat

The seat that the subject is associated with - blank if not on a local seat.

string session

The session that the subject is associated with.

string system_unit

The systemd unit that the subject's process is part of (if any). Note that this can only match on system units, as user units can be created with any name without privileges (unlike system units which require root to create). A process running in a user unit will return the user session unit in this attribute (e.g.: user-1000.service).

boolean local

Set to true only if seat is local.

boolean no_new_privileges

Set only if system_unit is not empty, and set to true only if the referenced systemd service unit has the NoNewPrivileges= setting enabled. This ensures that the process cannot gain any new privileges via executing setuid binaries.

boolean active

Set to true only if the session is active.

The following methods are available on the Subject type:

boolean isInGroup(string groupName);


 

boolean isInNetGroup(string netGroupName);


 

The isInGroup() method can be used to check if the subject is in a given group and isInNetGroup() can be used to check if the subject is in a given netgroup.



Более полная информация о правилах и их составлении дана на странице polkit или доступна по команде "man 8 polkit".

...