Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.6.0RC #1476

Merged
merged 146 commits into from
Oct 29, 2024
Merged

2.6.0RC #1476

Show file tree
Hide file tree
Changes from 142 commits
Commits
Show all changes
146 commits
Select commit Hold shift + click to select a range
e75aa89
Reverted DOCBRANCH to develop
Mohit04tomar Jul 1, 2024
a072897
permission optional attribute added in configuration manager
ashish-jabble Jul 2, 2024
b88a754
rest_api and passwords core based categories updated with permission …
ashish-jabble Jul 2, 2024
7dfeaf8
configuration tests updated with permission optional attribute
ashish-jabble Jul 2, 2024
dddc7ae
permissions attribute separate handling in list, kvlist configuration…
ashish-jabble Jul 2, 2024
aab3d1d
configuration bucket type skipped tests enabled
ashish-jabble Jul 2, 2024
f07807b
Merge pull request #1408 from fledge-iot/synch_main
Mohit04tomar Jul 2, 2024
2af9931
C configuration support for permission attribute
ashish-jabble Jul 2, 2024
22e8a61
Merge branch 'develop' of https://github.com/fledge-iot/fledge into F…
ashish-jabble Jul 2, 2024
1bd11cf
Update reject to the properties with permission property when the log…
ashish-jabble Jul 3, 2024
474a637
Merge branch 'FOGL-8760_C' into FOGL-8760
ashish-jabble Jul 3, 2024
dfec7f2
GET users API endpoint restricted for non-admin users
ashish-jabble Jul 4, 2024
33ada3f
Endpoints tests updated
ashish-jabble Jul 4, 2024
021bf2c
FOGL-8867 Add config cache size and log level documentation to tuning…
MarkRiddoch Jul 4, 2024
5624545
feedback changes
ashish-jabble Jul 5, 2024
f4b2972
C changes reverted
ashish-jabble Jul 5, 2024
2b9052c
Merge remote-tracking branch 'origin/develop' into FOGL-8760
ashish-jabble Jul 5, 2024
4b1331d
Merge branch 'develop' into FOGL-8865
ashish-jabble Jul 5, 2024
67b7d80
Merge pull request #1412 from fledge-iot/FOGL-8865
ashish-jabble Jul 5, 2024
b68b9dd
Merge branch 'develop' into FOGL-8760
ashish-jabble Jul 5, 2024
0f4b728
GET user role endpoint restricted for non-admin users
ashish-jabble Jul 5, 2024
4af18f8
Merge pull request #1411 from fledge-iot/FOGL-8760
ashish-jabble Jul 8, 2024
faa9db8
Removed redundant text in display name of Configuration Cache Manager
ashish-jabble Jul 9, 2024
8fa2539
text fixes in auth API
ashish-jabble Jul 9, 2024
ad9e672
role name handling in user model
ashish-jabble Jul 9, 2024
37646f5
Group by service filteration added in GET monitors ALL call
ashish-jabble Jul 9, 2024
7e8687a
File and directory utilities
RVerhoeff Jul 9, 2024
c9d33cb
minor fixes
ashish-jabble Jul 10, 2024
ddb3922
role tests added in user model
ashish-jabble Jul 10, 2024
144e07e
Merge pull request #1416 from fledge-iot/textual_fixes
ashish-jabble Jul 10, 2024
5869975
Fix comment
RVerhoeff Jul 10, 2024
99c353e
Merge branch 'develop' into FOGL-8538A
RVerhoeff Jul 10, 2024
8a2c5d0
FOGL-8840 Add C++ support for permissions property of configuration i…
MarkRiddoch Jul 11, 2024
714d393
Merge remote-tracking branch 'origin/develop' into FOGL-8469
ashish-jabble Jul 11, 2024
683a8ac
Merge pull request #1414 from fledge-iot/FOGL-8469
ashish-jabble Jul 11, 2024
bfb232e
Merge branch 'develop' into FOGL-8538A
RVerhoeff Jul 11, 2024
761be10
FOGL-8899: Fix for double free (#1418)
AmandeepArora Jul 12, 2024
ccec65c
FOGL-8285: Reset lastFetchedId on source change. (#1419)
cyberwalk3r Jul 12, 2024
075d742
Merge branch 'develop' into FOGL-8538A
RVerhoeff Jul 12, 2024
29de7f3
Merge pull request #1415 from fledge-iot/FOGL-8538A
RVerhoeff Jul 12, 2024
8330ab1
FOGL-8787: Fix for system failing due to delay in update of statistic…
Mohit04tomar Jul 16, 2024
855d6ac
permissions attribute handling in bucket config item
ashish-jabble Jul 17, 2024
74f8ab6
permissions unit tests for bucket config type added
ashish-jabble Jul 17, 2024
4cc85b6
Merge branch 'develop' into FOGL-8866
ashish-jabble Jul 17, 2024
8f440b3
critical option removed from core logging; to fix consistency as with…
ashish-jabble Jul 17, 2024
9bfe3ee
Merge pull request #1425 from fledge-iot/FOGL-8890
ashish-jabble Jul 18, 2024
46f3622
Merge branch 'develop' into FOGL-8904
ashish-jabble Jul 18, 2024
91bfaee
Merge pull request #1423 from fledge-iot/FOGL-8904
ashish-jabble Jul 18, 2024
3f9e802
setuptools pip dep fixes when python version is greater than 3.8
ashish-jabble Jul 19, 2024
339c8b8
Merge pull request #1426 from fledge-iot/FOGL-8917
ashish-jabble Jul 19, 2024
bbdcb8c
Merge branch 'develop' into FOGL-8866
ashish-jabble Jul 22, 2024
d30e14b
FOGL-8912: Merge develop3.0 (#1428)
pintomax Jul 22, 2024
b379b96
common utility function added to find out the differences between two…
ashish-jabble Jul 22, 2024
b90e91d
CONCH audit log entry fixes on the basis of python dict difference
ashish-jabble Jul 22, 2024
cd2e9de
Merge branch 'develop' into FOGL-8866
ashish-jabble Jul 24, 2024
b448935
Merge pull request #1424 from fledge-iot/FOGL-8866
ashish-jabble Jul 24, 2024
f13792a
Merge branch 'develop' into FOGL-8900
ashish-jabble Jul 24, 2024
035bb1c
Merge pull request #1429 from fledge-iot/FOGL-8900
ashish-jabble Jul 24, 2024
80fcfca
FOGL-8913: Fix readings count getting doubled on restart. (#1430)
cyberwalk3r Jul 25, 2024
cf8d2ff
FOGL-8947: Last send Id not updated for single send cycle. (#1431)
cyberwalk3r Jul 31, 2024
f0ae291
FOGL-8955: fix check of updateTable return value (#1433)
pintomax Jul 31, 2024
db18343
more restrictions added in update password API endpoint
ashish-jabble Aug 1, 2024
128e09c
unit tests updated
ashish-jabble Aug 1, 2024
a613c20
API integration tests updated
ashish-jabble Aug 1, 2024
d183f3a
Merge pull request #1435 from fledge-iot/FOGL-8932
ashish-jabble Aug 2, 2024
ea328b8
Firewall IP address class addition
ashish-jabble Aug 5, 2024
cf262d1
firewall category addition and be a child of rest_api category
ashish-jabble Aug 5, 2024
dce0a83
validation of firewall IP check in middleware and reject if does not …
ashish-jabble Aug 5, 2024
7073774
special handling of firewall category updates in core configuration m…
ashish-jabble Aug 5, 2024
95ee8db
API integration tests updated as per new firewall category
ashish-jabble Aug 6, 2024
af2ed42
textual feedback changes
ashish-jabble Aug 7, 2024
931ed4b
Removed server cyclic server imports and get replaced with Firewall s…
ashish-jabble Aug 7, 2024
5b95cad
Merge branch 'develop' into FOGL-8847
ashish-jabble Aug 8, 2024
dd6eadb
Merge pull request #1437 from fledge-iot/FOGL-8847
ashish-jabble Aug 8, 2024
47b14e0
FOGL-8982 Add documentation on allow and deny lists (#1439)
MarkRiddoch Aug 8, 2024
0832dd4
user model login exception unit test fixes
ashish-jabble Aug 13, 2024
9f5c264
Merge pull request #1442 from fledge-iot/FOGL-9000
ashish-jabble Aug 14, 2024
af80504
FOGL-8961 Fix issue with shutdown when in prefetch loop of north serv…
MarkRiddoch Aug 14, 2024
924cf56
FOGL-8591 Improve handling of exceptions in pipeline create and failu…
MarkRiddoch Aug 15, 2024
f1f978c
FOGL-9021 Add backoff mechansim in north service if plugin_send fails…
MarkRiddoch Aug 15, 2024
280df1a
Python metadata fixes in setup file
ashish-jabble Aug 16, 2024
e28ca99
FOGL-9029 Clear alert for failure to send data north and update docum…
MarkRiddoch Aug 16, 2024
cf0cbdb
DOC fixes for FOGL-9029 changes
ashish-jabble Aug 16, 2024
f444ccb
FOGL-9027 Resolve issue with Python filters sending data during (#1446)
MarkRiddoch Aug 16, 2024
b2992fd
original author reverted
ashish-jabble Aug 16, 2024
e9202b7
Merge branch 'develop' into FOGL-9029.doc-patch
ashish-jabble Aug 16, 2024
dd466fb
Merge pull request #1448 from fledge-iot/FOGL-9029.doc-patch
ashish-jabble Aug 16, 2024
695ce05
Merge branch 'develop' into FOGL-9004
ashish-jabble Aug 16, 2024
1369013
Merge pull request #1447 from fledge-iot/FOGL-9004
ashish-jabble Aug 20, 2024
3215df3
datetime format helper function added in tests
ashish-jabble Aug 21, 2024
0e3bcad
timestamp format verification added in existing API tests
ashish-jabble Aug 21, 2024
e2ccef4
browser API tests date format verification with helper function and o…
ashish-jabble Aug 21, 2024
4129c8e
browser API readings timestamp verification added with different time…
ashish-jabble Aug 21, 2024
fe6a9da
pytz test pip dep added
ashish-jabble Aug 21, 2024
c0d56df
Content-Type fixes in Response header of backup download API
ashish-jabble Aug 22, 2024
f56c762
Added Pytest xfail marker for FOGL-7712 (#1450)
Mohit04tomar Aug 22, 2024
ac29b60
ts value column fixes in backups table for SQLite while uploading a b…
ashish-jabble Aug 22, 2024
4a5f37f
Merge branch 'develop' into FOGL-8796
ashish-jabble Aug 22, 2024
c3c1021
Merge pull request #1451 from fledge-iot/FOGL-8796
ashish-jabble Aug 23, 2024
6a7c515
Merge branch 'develop' into FOGL-8951
ashish-jabble Aug 23, 2024
b431e01
Merge pull request #1452 from fledge-iot/FOGL-8951
ashish-jabble Aug 23, 2024
2d84094
handling of scheduler not ready exception on GET north schedule API
ashish-jabble Aug 27, 2024
aabc049
message fixes
ashish-jabble Aug 27, 2024
bab3c2f
Merge pull request #1454 from fledge-iot/FOGL-9024
ashish-jabble Aug 28, 2024
c87dfb2
computation fixes of categories list in PUT pipeline filter API for n…
ashish-jabble Aug 29, 2024
e4e01ce
allowed retrigger_time to 0 in notification API
ashish-jabble Aug 30, 2024
b9d2ecc
Merge pull request #1457 from fledge-iot/FOGL-9068
ashish-jabble Aug 30, 2024
a18b3d4
permissions user type check fixes in single item update configuration…
ashish-jabble Sep 2, 2024
99025d7
Merge branch 'develop' into FOGL-9047
ashish-jabble Sep 2, 2024
8ca6ff4
Merge pull request #1456 from fledge-iot/FOGL-9047
ashish-jabble Sep 2, 2024
659c581
special case to open GET list of all users API for control user
ashish-jabble Sep 3, 2024
8acfb03
FOGL-9032 Add basic disk usage monitoring for the disks holding stora…
MarkRiddoch Sep 3, 2024
2ae7f8f
Merge branch 'develop' into FOGL-8918
ashish-jabble Sep 3, 2024
a8b0d38
Merge pull request #1458 from fledge-iot/FOGL-8918
ashish-jabble Sep 3, 2024
5180660
Merge branch 'develop' into FOGL-8894
ashish-jabble Sep 3, 2024
d57bb2e
FOGL-8944 Alter branch completion criteria to allow for filter plugin…
MarkRiddoch Sep 3, 2024
a860975
Merge branch 'develop' into FOGL-8894
ashish-jabble Sep 4, 2024
e127164
Forbidden case added in GET user profile API; only admin & control ro…
ashish-jabble Sep 4, 2024
3f34a4c
API integration tests for GET user Profile API for forbidden case added
ashish-jabble Sep 4, 2024
2559093
Merge pull request #1459 from fledge-iot/FOGL-8894
ashish-jabble Sep 4, 2024
096425c
conflicts resolved
ashish-jabble Sep 4, 2024
8f887a5
FOGL-9091 Improve error reporting and rate limit error logs when we h…
MarkRiddoch Sep 5, 2024
4782b24
Merge branch 'develop' into FOGL-8892
ashish-jabble Sep 5, 2024
f424a37
Merge pull request #1460 from fledge-iot/FOGL-8892
ashish-jabble Sep 6, 2024
a136cd2
parent-child relationship and display name fixes for backup and resto…
ashish-jabble Sep 9, 2024
d2a7c24
Merge pull request #1462 from fledge-iot/FOGL-9073
ashish-jabble Sep 10, 2024
1209a5c
FOGL-9061: modified asset to have html encoded value (#1463)
gnandan Sep 18, 2024
b55ad0d
Fixes for executing the entry point when anonymous access is enabled
ashish-jabble Sep 25, 2024
524729f
Merge pull request #1465 from fledge-iot/FOGL-9105
ashish-jabble Sep 27, 2024
e675325
API statistics schedule time fixes in tests
ashish-jabble Sep 30, 2024
0a71e03
FOGL-9143: remove "\n" string from JSON object (#1467)
pintomax Sep 30, 2024
e151121
Merge branch 'develop' into stats-api-test-fixes
ashish-jabble Oct 1, 2024
89b465e
Merge pull request #1469 from fledge-iot/stats-api-test-fixes
ashish-jabble Oct 1, 2024
7e0929d
Make OMF Data Action code configurable
RVerhoeff Oct 7, 2024
92e7283
Added Action Code for Data Messages
RVerhoeff Oct 7, 2024
082a096
New Basic tab screenshot
RVerhoeff Oct 7, 2024
964b823
Merge pull request #1470 from fledge-iot/FOGL-9164
RVerhoeff Oct 8, 2024
1e47cbd
FOGL-9037 Add a monitoring section to the documentation (#1471)
MarkRiddoch Oct 14, 2024
abcc7e4
FOGL-9122: Create JSON array datapoint if not blank (#1472)
gnandan Oct 21, 2024
cea35a4
FOGL-9206 Correct image names (#1474)
MarkRiddoch Oct 22, 2024
969e4b4
FOGL-9157 Correct delete user documentation (#1475)
MarkRiddoch Oct 23, 2024
a3479f9
VERSION changed
dianomicbot Oct 24, 2024
ca10b58
fledge specific documentation updates for v2.6.0
ashish-jabble Oct 25, 2024
d0297c9
feedback fixes
ashish-jabble Oct 25, 2024
0df9837
minor fixes
ashish-jabble Oct 28, 2024
422bd66
Merge pull request #1479 from fledge-iot/2.6.0-docs
ashish-jabble Oct 28, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
86 changes: 86 additions & 0 deletions C/common/config_category.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
#include <logger.h>
#include <stdexcept>
#include <string_utils.h>
#include <boost/algorithm/string/replace.hpp>


using namespace std;
Expand Down Expand Up @@ -872,6 +873,50 @@ vector<string> ConfigCategory::getOptions(const string& name) const
throw new ConfigItemNotFound();
}

/**
* Return the permissions of the configuration category item
*
* @param name The name of the configuration item to return
* @return vector<string> The configuration item permissions
* @throws exception if the item does not exist in the category
*/
vector<string> ConfigCategory::getPermissions(const string& name) const
{
for (unsigned int i = 0; i < m_items.size(); i++)
{
if (name.compare(m_items[i]->m_name) == 0)
{
return m_items[i]->m_permissions;
}
}
throw new ConfigItemNotFound();
}

/**
* Return true if the user has permission to update the named item
*
* @param name The name of the configuration item to return
* @param rolename The name of the user role to test
* @return bool True if the named user can update the configuration item
* @throws exception if the item does not exist in the category
*/
bool ConfigCategory::hasPermission(const std::string& name, const std::string& rolename) const
{
for (unsigned int i = 0; i < m_items.size(); i++)
{
if (name.compare(m_items[i]->m_name) == 0)
{
if (m_items[i]->m_permissions.empty())
return true;
for (auto& perm : m_items[i]->m_permissions)
if (rolename.compare(perm) == 0)
return true;
return false;
}
}
throw new ConfigItemNotFound();
}

/**
* Return if the configuration item is a string item
*
Expand Down Expand Up @@ -1300,6 +1345,18 @@ ConfigCategory::CategoryItem::CategoryItem(const string& name,
}
}

if (item.HasMember("permissions"))
{
const Value& permissions = item["permissions"];
if (permissions.IsArray())
{
for (SizeType i = 0; i < permissions.Size(); i++)
{
m_permissions.push_back(string(permissions[i].GetString()));
}
}
}

if (item.HasMember("items"))
{
if (item["items"].IsString())
Expand Down Expand Up @@ -1358,6 +1415,7 @@ ConfigCategory::CategoryItem::CategoryItem(const string& name,
// If it's not a real eject, check the string buffer it is:
if (!item["value"].IsObject())
{
boost::replace_all(m_value, "\\n", "");
Document check;
check.Parse(m_value.c_str());
if (check.HasParseError())
Expand Down Expand Up @@ -1466,6 +1524,7 @@ ConfigCategory::CategoryItem::CategoryItem(const string& name,
// If it's not a real eject, check the string buffer it is:
if (!item["default"].IsObject())
{
boost::replace_all(m_default, "\\n", "");
Document check;
check.Parse(m_default.c_str());
if (check.HasParseError())
Expand Down Expand Up @@ -1624,6 +1683,10 @@ ConfigCategory::CategoryItem::CategoryItem(const CategoryItem& rhs)
m_listSize = rhs.m_listSize;
m_listItemType = rhs.m_listItemType;
m_listName = rhs.m_listName;
for (auto it = rhs.m_permissions.cbegin(); it != rhs.m_permissions.cend(); it++)
{
m_permissions.push_back(*it);
}
}

/**
Expand Down Expand Up @@ -1655,6 +1718,18 @@ ostringstream convert;
convert << "], ";
}

if (m_permissions.size() > 0)
{
convert << "\"permissions\" : [ ";
for (int i = 0; i < m_permissions.size(); i++)
{
if (i > 0)
convert << ",";
convert << "\"" << m_permissions[i] << "\"";
}
convert << "], ";
}

if (m_itemType == StringItem ||
m_itemType == BoolItem ||
m_itemType == EnumerationItem ||
Expand Down Expand Up @@ -1835,6 +1910,17 @@ ostringstream convert;
}
convert << "]";
}
if (m_permissions.size() > 0)
{
convert << ", \"permissions\" : [ ";
for (int i = 0; i < m_permissions.size(); i++)
{
if (i > 0)
convert << ",";
convert << "\"" << m_permissions[i] << "\"";
}
convert << "]";
}
if (!m_listSize.empty())
{
convert << ", \"listSize\" : \"" << m_listSize << "\"";
Expand Down
130 changes: 130 additions & 0 deletions C/common/file_utils.cpp
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
/*
* Fledge utilities functions for handling files and directories
*
* Copyright (c) 2024 Dianomic Systems
*
* Released under the Apache 2.0 Licence
*
* Author: Ray Verhoeff
*/

#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <ftw.h>
#include <stdexcept>
#include "file_utils.h"

/**
* Callback for Linux file walk routine 'nftw'
*
* @param filePath File full path
* @param sb struct stat to hold file information
* @param typeflag File type flag: FTW_F = file, FTW_D = directory
* @param ftwbuf struct FTW to hold name offset and file depth
* @return Zero if successful
*/
static int fileDeleteCallback(const char *filePath, const struct stat *sb, int typeflag, struct FTW *ftwbuf)
{
return remove(filePath);
}

/**
* Copy a file
*
* @param to Full path of the destination file
* @param from Full path of the source file
* @return Zero if successful
*/
int copyFile(const char *to, const char *from)
{
int fd_to, fd_from;
char buf[4096];
ssize_t nread;
int saved_errno;

fd_from = open(from, O_RDONLY);
if (fd_from < 0)
return -1;

fd_to = open(to, O_WRONLY | O_CREAT | O_EXCL, 0666);
if (fd_to < 0)
goto out_error;

while (nread = read(fd_from, buf, sizeof buf), nread > 0)
{
char *out_ptr = buf;
ssize_t nwritten;

do
{
nwritten = write(fd_to, out_ptr, nread);

if (nwritten >= 0)
{
nread -= nwritten;
out_ptr += nwritten;
}
else if (errno != EINTR)
{
goto out_error;
}
} while (nread > 0);
}

if (nread == 0)
{
if (close(fd_to) < 0)
{
fd_to = -1;
goto out_error;
}
close(fd_from);

/* Success! */
return 0;
}

out_error:
saved_errno = errno;

close(fd_from);
if (fd_to >= 0)
close(fd_to);

errno = saved_errno;
return -1;
}

/**
* Create a single directory.
* This routine cannot create a directory tree from a full path.
* This routine throws a std::runtime_error exception if the directory cannot be created.
*
* @param directoryName Full path of the directory to create
*/
void createDirectory(const std::string &directoryName)
{
const char *path = directoryName.c_str();
struct stat sb;
if (stat(path, &sb) != 0)
{
int retcode;
if ((retcode = mkdir(path, S_IRWXU | S_IRWXG)) != 0)
{
std::string exceptionMessage = "Unable to create directory " + directoryName + ": error: " + std::to_string(retcode);
throw std::runtime_error(exceptionMessage.c_str());
}
}
}

/**
* Remove a directory with all subdirectories and files
*
* @param path Full path of the directory
* @return Zero if successful
*/
int removeDirectory(const char *path)
{
return nftw(path, fileDeleteCallback, 64, FTW_DEPTH | FTW_PHYS);
}
Loading