introspect: Add helper to check method call permission
https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/757
This commit is contained in:
parent
0057c19bfc
commit
059fb5c7cb
@ -119,9 +119,18 @@ var IntrospectService = class {
|
|||||||
type == Meta.WindowType.UTILITY;
|
type == Meta.WindowType.UTILITY;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
_isInvocationAllowed(invocation) {
|
||||||
|
if (this._isIntrospectEnabled())
|
||||||
|
return true;
|
||||||
|
|
||||||
|
if (this._isSenderWhitelisted(invocation.get_sender()))
|
||||||
|
return true;
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
GetRunningApplicationsAsync(params, invocation) {
|
GetRunningApplicationsAsync(params, invocation) {
|
||||||
if (!this._isIntrospectEnabled() &&
|
if (!this._isInvocationAllowed(invocation)) {
|
||||||
!this._isSenderWhitelisted(invocation.get_sender())) {
|
|
||||||
invocation.return_error_literal(Gio.DBusError,
|
invocation.return_error_literal(Gio.DBusError,
|
||||||
Gio.DBusError.ACCESS_DENIED,
|
Gio.DBusError.ACCESS_DENIED,
|
||||||
'App introspection not allowed');
|
'App introspection not allowed');
|
||||||
@ -136,8 +145,7 @@ var IntrospectService = class {
|
|||||||
let apps = this._appSystem.get_running();
|
let apps = this._appSystem.get_running();
|
||||||
let windowsList = {};
|
let windowsList = {};
|
||||||
|
|
||||||
if (!this._isIntrospectEnabled() &&
|
if (!this._isInvocationAllowed(invocation)) {
|
||||||
!this._isSenderWhitelisted(invocation.get_sender())) {
|
|
||||||
invocation.return_error_literal(Gio.DBusError,
|
invocation.return_error_literal(Gio.DBusError,
|
||||||
Gio.DBusError.ACCESS_DENIED,
|
Gio.DBusError.ACCESS_DENIED,
|
||||||
'App introspection not allowed');
|
'App introspection not allowed');
|
||||||
|
Loading…
Reference in New Issue
Block a user