102 Commits

Author SHA1 Message Date
Dušan Borovčanin 61d0427898 NOISSUE - Rename to Magistrala (#3427)
Signed-off-by: dusan <borovcanindusan1@gmail.com>
2026-04-06 15:23:42 +02:00
Dušan Borovčanin abd669c610 NOISSUE - Improve SQL queries performance and safety (#3378)
Signed-off-by: dusan <borovcanindusan1@gmail.com>
2026-03-06 11:09:40 +01:00
Felix Gateru f8410b8940 SMQ-3338 - Add created at period filter to entities (#3339)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2026-03-04 12:37:35 +01:00
Steve Munene 03143d4142 NOISSUE - Add migrations for UI metadata (#3366)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2026-02-27 17:00:04 +01:00
Felix Gateru 4e77ae65e2 SMQ-2875 - Add listing entities by multiple tag values with support for AND/OR conditions (#3154)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2026-02-04 17:13:48 +01:00
Felix Gateru 59d9f91813 NOISSUE - Remove public metadata, introduce private metadata (#3322)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2026-01-23 14:42:54 +01:00
Felix Gateru 5b913dd46b SMQ-3108 - Add support for public and private metadata for users and clients (#3155)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2026-01-22 08:55:25 +01:00
Felix Gateru f9b503f1d6 SMQ-3125 - Add ordering tests (#3297)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2025-12-22 15:01:57 +01:00
Arvindh 3fcf2e5369 SMQ-1744 - Error handling with TypedError created on top existing Error (#3170)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Co-authored-by: Felix Gateru <felix.gateru@gmail.com>
2025-12-22 08:31:52 +01:00
Arvindh 27995cb093 NOISSUE - Add Auth provider in profile view response (#3187)
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Co-authored-by: nyagamunene <stevenyaga2014@gmail.com>
2025-10-15 14:17:37 +02:00
Arvindh b0e9e43b9e NOISSUE - Handle user registration errors (#3177)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2025-10-08 19:56:54 +02:00
Steve Munene ae7c93020a SMQ-3028 - Unify SMQ certs with Absmach Certs (#3146)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2025-10-01 11:08:33 +02:00
Felix Gateru b031dc08b8 NOISSUE - Group service middleware into single folder (#2472)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2025-09-26 13:55:00 +02:00
Nataly Musilah 29f7063c15 NOISSUE - Fix Groups and Channels Users Listing (#3138)
Signed-off-by: musilah <nataleigh.nk@gmail.com>
2025-09-18 11:28:40 +02:00
Nataly Musilah c50221a042 NOISSUE - Update entity sorting (#3076)
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
Signed-off-by: musilah <nataleigh.nk@gmail.com>
2025-09-05 15:58:03 +02:00
Arvindh e57ad79cd4 SMQ-3093 - User email verification (#3101)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2025-09-05 15:23:58 +02:00
Dušan Borovčanin a19cd9c97b NOISSUE - Replace interface{} with any (#3079)
Signed-off-by: dusan <borovcanindusan1@gmail.com>
2025-08-25 18:06:41 +02:00
Nataly Musilah 2e3f52fdbf NOISSUE - Allow sorting (#3052)
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
2025-08-18 14:54:26 +02:00
Steve Munene d4dc7ffe35 SMQ-2873 - Switch to TIMESTAMPZ in Postgres (#3015)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2025-07-14 23:35:47 +02:00
Steve Munene 376bc8b9c4 SMQ-2840 - Retrieve entity total with filter options (#2961)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2025-07-10 17:36:31 +02:00
Felix Gateru d6c260b803 SMQ-2874 - Allow empty update for user profile picture, tags and metadata (#2876)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2025-05-20 10:29:24 +02:00
Dušan Borovčanin 9a9e22fbce SMQ-2869 - Switch to UTC time on backends (#2870)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2025-05-15 12:01:34 +02:00
Dušan Borovčanin f0d014eba2 NOISSUE - Move API to the common package (#2608)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-12-19 18:29:53 +01:00
Dušan Borovčanin 178aa46ad4 SMQ-2533 - Rename Magistrala to SuperMQ (#2560)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-12-04 11:17:09 +01:00
Dušan Borovčanin 243ccade0b MG-2456 - Refactor architecture (#2494)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
Co-authored-by: Felix Gateru <felix.gateru@gmail.com>
2024-12-03 17:12:46 +01:00
Felix Gateru ba556e1e0d NOISSUE - Fix return role on user creation (#2551)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2024-11-26 09:39:52 +01:00
Steve Munene 54a134e72f MG-2516 - Fix listing users in domain (#2526)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2024-11-13 08:29:32 -07:00
Nataly Musilah 87c390da4c MG-2426 - Replace generic Clients in Things service (#2476)
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Co-authored-by: Felix Gateru <felix.gateru@gmail.com>
2024-11-04 11:46:40 +01:00
Felix Gateru 233bbf9861 NOISSUE - Update Users tests (#2498)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2024-11-04 09:42:09 +01:00
Nataly Musilah 0019f71b46 MG-2426 - Replace generic Clients in Users service (#2436)
Signed-off-by: Musilah <nataleigh.nk@gmail.com>
Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
Co-authored-by: Arvindh <arvindh91@gmail.com>
Co-authored-by: Felix Gateru <felix.gateru@gmail.com>
Co-authored-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-10-30 19:19:31 +01:00
b1ackd0t ee3716623c MG-1557 - Export jaeger, metrics, postgres and apiutil packages (#2262)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
2024-06-28 12:45:20 +02:00
Dušan Borovčanin 658003080e NOISSUE - Update Docker and Compose versions (#2159)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-04-10 12:02:36 +02:00
Dušan Borovčanin a39d46238b NOISSUE - Fix links in README.md file (#2129)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-04-03 11:55:06 +02:00
b1ackd0t 70c3d65863 NOISSUE - Add property based testing to users service (#2087)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-03-22 16:16:07 +01:00
b1ackd0t 0f05c10a38 MG-1887 - Add support for OAuth2.0 (#2103)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-03-01 10:51:34 +01:00
b1ackd0t 0ed79371a4 NOISSUE - Remove duplicate errors (#2086)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-02-21 14:31:11 +01:00
Arvindh 2c4880485d MG-104: Rename/Replace filed owner with domain (#268)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2024-01-27 22:47:00 +01:00
Dušan Borovčanin 79ef28a9ce NOISSUE - Update dependencies (#2061)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-01-23 13:09:07 +01:00
Felix Gateru d7cd911613 NOISSUE - Improve tests in users service (#194)
Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2024-01-18 17:14:46 +01:00
b1ackd0t fe97de024c NOISSUE - Add tests for pkg/clients (#258)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2024-01-16 13:25:52 +01:00
b1ackd0t da79c82208 NOISSUE - Generate Users repository mocks (#160)
* Generate users repository mocks

Add generation of users repository mocks for easier testing purposes
rather than writing the mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* Change output dir for generated mocks

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-15 14:32:16 +01:00
b1ackd0t 71e600798d MG-132 - Remove Identity From Basic Information (#94)
* refactor(clients): deprecate RetrieveNames

Remove RetrieveNames and modify RetrieveAllBasicInfo to replace it. Remove sensitive information when retrieving basic information

* change from if statement to switch

Co-authored-by: Dušan Borovčanin <borovcanindusan1@gmail.com>

---------

Co-authored-by: Dušan Borovčanin <borovcanindusan1@gmail.com>
2023-12-07 13:56:34 +01:00
b1ackd0t 38b50cb6c0 NOISSUE - Repository Retrieve User By Name (#84)
* feat: add retrieve users by name

Retrieve users by name from the database. This is a new feature. It
enables the user to retrieve users by name.

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>

* test: bump up test cases

The changes made in this commit involve modifying the RetrieveNames function in the clients.go file. The function now retrieves client names by constructing a query. Additionally, test cases have been added to ensure the correct retrieval of clients with different parameters and to assert the expected response and error values.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* fix: add direction only when we have order

When constructing a query, the function now checks if the order parameter is provided and if it is one of the allowed values (name, identity, created_at, updated_at). If so, the function adds an ORDER BY clause to the query. Additionally, if the direction parameter is provided and it is either "asc" or "desc", the function adds the direction to the query.

This change enables users to specify the order in which the query results should be returned and the direction of the ordering.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* fix: fix sorting direction check in constructQuery

The fix updates the check to use the constants from the api package for clarity and consistency.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(users): add ID field to RetrieveNames query

Added the ID field to the SELECT query in the RetrieveNames function in clients.go. This change allows the function to retrieve the ID along with the name of the clients.

Also modified the clients_test.go file to include the ID field in the test data for the RetrieveNames test.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* feat(db): Test for SQL injection

This commit adds a new feature by including a username field in the client information. It also modifies the retrieval of client names and adds tests to prevent SQL injection. Additionally, it introduces functions for retrieving clients based on their identity and includes test functions for retrieving clients based on different criteria. The code also includes functions for setting parameters and finding clients based on specific queries.

* feat(users): update SQL query in RetrieveNames

This commit updates the SQL query in the RetrieveNames function in the users/postgres/clients.go file. The query now uses the '~' operator instead of 'ILIKE' for the name and identity conditions. This change improves the search functionality by allowing for more flexible matching.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-04 15:05:52 +01:00
Nataly Musilah 94c5a36929 MG-90 - Fix CI (#93)
* fix ci

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* add status badge

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* remove badge

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* add status badge

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* fix gofumpt error

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* remove badge again

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* return badges

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* clean cache

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* fix lint errors

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

* fix clients.go

Signed-off-by: Musilah <nataleigh.nk@gmail.co>

---------

Signed-off-by: Musilah <nataleigh.nk@gmail.co>
Co-authored-by: Musilah <nataleigh.nk@gmail.co>
2023-11-30 17:33:29 +01:00
Arvindh 6f195f816e NOISSUE - Fix Update user roles, Listing and retrieve users with role (#76)
* remove: UpdateClientOwner from things service

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: user role update, listing and retrieve

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: add user to have dual relationship to platform, so for update role just add or remove admin relation

Signed-off-by: Arvindh <arvindh91@gmail.com>

* add: users permission sdk

Signed-off-by: Arvindh <arvindh91@gmail.com>

* fix: grammer

Signed-off-by: Arvindh <arvindh91@gmail.com>

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-11-29 13:54:49 +01:00
Felix Gateru 705560efd6 MG-12 - Improve Error Handling (#18)
* Add service error type

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Wrap errors in users service

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Solve merge errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Wrap errors in users service

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Wrap errors in things service

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Wrap errors in twins

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Wrap errors in bootstrap

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update provision

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update error tags

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Remove repo errors from transport layer

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Add copyright headers

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Resolve conflicts

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Remove apiutil from service

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update postgres errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Handle token errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Handle token errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update auth errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update auth errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update errors in auth

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update users service

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update license header

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* fix ci

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update error definitions

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update error wrapping

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* update error type definitions

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* update error type definitions

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* update error type definitions

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Rename import aliases

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Rename import aliases

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Refactor postgres errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update errors

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Fix ci

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update errors in transport

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* Update errors in transport

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

* update error definitions

Signed-off-by: felix.gateru <felix.gateru@gmail.com>

---------

Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2023-11-24 00:52:04 +01:00
b1ackd0t dd3fb241b0 NOISSUE - Make Username Unique (#75)
* feat(users): add unique constraint to clients name

This commit adds a new migration to the users. The migration adds a unique constraint to the "clients" table in the database. This constraint ensures that the "name" column of the "clients" table is unique.

* feat: add tests

This commit adds constraints to the PostgreSQL database code for saving clients. Specifically, it ensures that the name column is not null and unique.
The code includes test cases with descriptions, client objects, and expected errors to cover scenarios such as adding clients successfully. These changes enhance the functionality and reliability of the codebase.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* fix: no need for seperate migration

This commit fixes an issue in the clients table in the PostgreSQL database. The name column is now set to NOT NULL and UNIQUE, ensuring that every client has a name and that the name is unique. This change improves data integrity and prevents any potential data inconsistencies.
Note: This commit does not include the clients_02 migration as it has been removed.

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-11-23 13:39:04 +01:00
b1ackd0t 7c5ad097b9 NOISSUE - Fix loading Auth config (#64)
Fix bug in loading auth config and also refactor postgres connect
2023-11-20 14:06:00 +01:00
b1ackd0t a0c40ba462 NOISSUE - Update Copyright Notice (#39)
* chore(license): update copyright notices

Add CI check for non go files to check that the files contain a license

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

* fix(ci): log failed files

When the CI fails during check for license header, log the failed file to console so that someone can check on the actual file. Also simplify the grep check to make it more human readable and understandable

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-11-17 12:37:30 +01:00
Arvindh c294e84d24 NOISSUES - Implement Domains for access control (#14)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-11-16 15:39:05 +01:00