Some information should be protected from public users.
So the users of capi only can access to attirbutes
which have PUBLIC visibility. By using the added
libpass function, we can enforce the user of capi to
only access PUBLIC attributes. If the user tries to
access PRIVATE attributes, the set attribute function
will return RESOURCE_MONITOR_ERROR_PERMISSION_DENIED
error.
Change-Id: If7f40a7cf4e2c0987fa3594a6e3e3f0839c0aded
Signed-off-by: Sung-hun Kim <sfoon.kim@samsung.com>
int resource_monitor_create_resource(int monitor_id, resource_monitor_type_e resource_type)
{
- return pass_resource_monitor_create_resource(monitor_id, resource_type);
+ int ret;
+ int resource_id = pass_resource_monitor_create_resource(monitor_id, resource_type);
+
+ if (resource_id < 0)
+ return resource_id;
+
+ ret = pass_resource_monitor_set_resource_flag(monitor_id, resource_id, RESOURCE_FLAG_PUBLIC);
+ if (ret < 0)
+ return ret;
+ return resource_id;
}
int resource_monitor_delete_resource(int monitor_id, int resource_id)