26 #ifndef OPENVAS_MANAGER_MANAGE_ACL_H 27 #define OPENVAS_MANAGER_MANAGE_ACL_H 37 #define ACL_USER_MAY(resource) \ 38 "SELECT count(*) > 0 FROM permissions" \ 39 " WHERE resource = " resource \ 40 " AND subject_location = " G_STRINGIFY (LOCATION_TABLE) \ 41 " AND ((subject_type = 'user'" \ 43 " = (SELECT id FROM users" \ 44 " WHERE users.uuid = '%s'))" \ 45 " OR (subject_type = 'group'" \ 47 " IN (SELECT DISTINCT \"group\"" \ 49 " WHERE \"user\" = (SELECT id" \ 53 " OR (subject_type = 'role'" \ 55 " IN (SELECT DISTINCT role" \ 57 " WHERE \"user\" = (SELECT id" \ 62 " AND ((lower (substr ('%s', 1, 3)) = 'get'" \ 63 " AND name LIKE '%%'" \ 64 " || lower (substr ('%s'," \ 66 " length ('%s') - 5)))" \ 67 " OR name = lower ('%s'))" 74 #define ACL_IS_GLOBAL() \ 85 #define ACL_USER_OWNS() \ 86 " ((" ACL_IS_GLOBAL () ")" \ 87 " OR (owner = (SELECT users.id FROM users" \ 88 " WHERE users.uuid = '%s')))" int acl_user_has_super(const char *, user_t)
Test whether a user has super permission on another user.
int acl_user_can_everything(const char *)
Test whether a user may perform any operation.
int acl_user_owns_name(const char *, const char *)
Test whether a user effectively owns a resource.
gchar * acl_where_owned_user(const char *, const char *, const char *, const get_data_t *, int, const gchar *, resource_t, array_t *)
Generate the ownership part of an SQL WHERE clause for a given user.
gchar * acl_users_with_access_where(const char *, const char *, const char *, const char *)
Get a static SQL condition selecting users that can get a resource.
int acl_user_can_super_everyone(const char *)
Check whether a user is a Super Admin.
int acl_user_owns_uuid(const char *, const char *, int)
Test whether a user effectively owns a resource.
int acl_user_is_admin(const char *)
Check whether a user is an Admin.
Command data for a get command.
gchar * acl_where_owned(const char *, const get_data_t *, int, const gchar *, resource_t, array_t *)
Generate the ownership part of an SQL WHERE clause.
int acl_user_is_observer(const char *)
Check whether a user is an Observer.
int acl_user_owns_trash_uuid(const char *resource, const char *uuid)
Test whether a user effectively owns a resource.
int acl_user_owns(const char *, resource_t, int)
Test whether a user effectively owns a resource.
gchar * acl_users_with_access_sql(const char *, const char *, const char *)
Get an SQL values expression of users that can get a resource.
gchar * acl_where_owned_for_get(const char *, const char *)
Generate ownership part of WHERE, for getting a type of resource.
int acl_user_has_access_uuid(const char *, const char *, const char *, int)
Test whether the user may access a resource.
int acl_user_may(const char *)
Test whether a user may perform an operation.
int acl_user_is_user(const char *)
Check whether a user has the User role.
int acl_role_can_super_everyone(const char *)
Check whether a role has Super Admin capability.
int acl_user_is_owner(const char *, const char *)
Test whether a user is the actual owner of a resource.
int acl_user_is_super_admin(const char *)
long long int resource_t
A resource, like a task or target.