mirror of
https://github.com/labwc/labwc.git
synced 2026-04-07 08:21:20 -04:00
add permissions to actions
This commit is contained in:
parent
433c898839
commit
d85e7d8158
6 changed files with 24 additions and 7 deletions
|
|
@ -26,6 +26,7 @@
|
|||
#include "menu/menu.h"
|
||||
#include "output.h"
|
||||
#include "output-virtual.h"
|
||||
#include "permissions.h"
|
||||
#include "regions.h"
|
||||
#include "ssd.h"
|
||||
#include "theme.h"
|
||||
|
|
@ -335,6 +336,9 @@ action_arg_from_xml_node(struct action *action, const char *nodename, const char
|
|||
if (!strcmp(argument, "command") || !strcmp(argument, "execute")) {
|
||||
action_arg_add_str(action, "command", content);
|
||||
goto cleanup;
|
||||
} else if (!strcmp(argument, "permission")) {
|
||||
action->permissions |= permissions_from_interface_name(content);
|
||||
goto cleanup;
|
||||
}
|
||||
break;
|
||||
case ACTION_TYPE_MOVE_TO_EDGE:
|
||||
|
|
@ -603,6 +607,7 @@ action_create(const char *action_name)
|
|||
|
||||
struct action *action = znew(*action);
|
||||
action->type = action_type;
|
||||
action->permissions = 0;
|
||||
wl_list_init(&action->args);
|
||||
return action;
|
||||
}
|
||||
|
|
@ -1115,7 +1120,8 @@ run_action(struct view *view, struct server *server, struct action *action,
|
|||
struct buf cmd = BUF_INIT;
|
||||
buf_add(&cmd, action_get_str(action, "command", NULL));
|
||||
buf_expand_tilde(&cmd);
|
||||
spawn_async_no_shell(cmd.data);
|
||||
int socket_fd = permissions_context_create(server->wl_display, action->permissions);
|
||||
spawn_async_no_shell(cmd.data, socket_fd);
|
||||
buf_reset(&cmd);
|
||||
break;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue