38 Commits

Author SHA1 Message Date
Steve Munene 683809dc6b NOISSUE - Update bootstrap content format, update profile method and add profile search (#3515)
Property Based Tests / api-test (push) Has been cancelled
Continuous Delivery / lint-and-build (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
CI Pipeline / Lint Proto (push) Has been cancelled
Continuous Delivery / Build and Push Docker Images (push) Has been cancelled
CI Pipeline / lint-and-build (push) Has been cancelled
CI Pipeline / Test ${{ matrix.module }} (push) Has been cancelled
CI Pipeline / Upload Coverage (push) Has been cancelled
CI Pipeline / Detect Changes (push) Has been cancelled
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2026-05-19 09:02:45 +02:00
Steve Munene 7f03134d8e NOISSUE - Update bootstrap and provision service (#3476)
Property Based Tests / api-test (push) Has been cancelled
Continuous Delivery / lint-and-build (push) Has been cancelled
Deploy GitHub Pages / swagger-ui (push) Has been cancelled
CI Pipeline / Lint Proto (push) Has been cancelled
CI Pipeline / Detect Changes (push) Has been cancelled
Continuous Delivery / Build and Push Docker Images (push) Has been cancelled
CI Pipeline / lint-and-build (push) Has been cancelled
CI Pipeline / Test ${{ matrix.module }} (push) Has been cancelled
CI Pipeline / Upload Coverage (push) Has been cancelled
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
Co-authored-by: JeffMboya <jangina.mboya@gmail.com>
2026-05-08 10:35:00 +02:00
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 ef5c253c51 SMQ-3399 - Unify Magistrala and SuperMQ (#3400)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
Signed-off-by: dusan <borovcanindusan1@gmail.com>
Co-authored-by: Steve Munene <stevenyaga2014@gmail.com>
2026-04-01 09:55:11 +02:00
Felix Gateru df5d752c4b SMQ-2629 - Remove Boostrap and Provision services (#2640)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2025-01-10 09:56:03 +01:00
Felix Gateru 4f73a52192 SMQ-2570 - Update SDK to align with new architecture (#2585)
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
2024-12-23 15:09:06 +01:00
Dušan Borovčanin 559e05f0f4 NOISSUE - Move SDK to pkg (#2583)
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
2024-12-10 14:23:35 +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
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
Steve Munene ca8ed3b006 MG-2441 - Add domain ID to API (#2442)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2024-10-23 21:40:13 +02:00
Dušan Borovčanin eb881690c7 MG-2443 - Move Auth to the middleware (#2444)
Signed-off-by: 1998-felix <felix.gateru@gmail.com>
Signed-off-by: Dusan Borovcanin <borovcanindusan1@gmail.com>
Signed-off-by: Felix Gateru <felix.gateru@gmail.com>
Signed-off-by: Arvindh <arvindh91@gmail.com>
Co-authored-by: Felix Gateru <felix.gateru@gmail.com>
Co-authored-by: Arvindh <arvindh91@gmail.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
2024-10-17 16:24:53 +02:00
b1ackd0t 2098c85287 NOISSUE - Update redis, uuid and env dependecies (#2418)
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2024-09-13 14:57:34 +02:00
Felix Gateru 48c4a7e7d4 MG-2264 - Split Auth Client into Separate Clients for AuthN/AuthZ and Policy CRUD (#2392)
Signed-off-by: 1998-felix <felix.gateru@gmail.com>
2024-09-03 16:50:28 +02:00
JMboya b49a2cd012 MG-1955 - Update Bootstrap service access control (#2199)
Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
2024-07-09 13:03:10 +02:00
b1ackd0t 0794363a3c MG-1965 - Process Event Logs (#2057)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2024-06-27 16:38:20 +02:00
JMboya 94053f37ee MG-2142 - Consume Things connect/disconnect event in Bootstrap (#2192)
Signed-off-by: JeffMboya <jangina.mboya@gmail.com>
2024-06-24 11:02:09 +02:00
Steve Munene ddb90a046a MG-2136 - Generate mocks with mockery for Bootstrap service (#2140)
Signed-off-by: nyagamunene <stevenyaga2014@gmail.com>
2024-04-09 11:48:45 +02:00
Arvindh 4c206ec375 NOISSUE - Fix Bootstrap thing creation flow (#2083)
Signed-off-by: Arvindh <arvindh91@gmail.com>
2024-02-19 16:03:21 +01:00
Felix Gateru 7a93e6a893 NOISSUE - Improve tests in Auth service (#262)
Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2024-01-25 14:03:20 +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
b1ackd0t 2944e8881e NOISSUE - Generate event sourcing mocks (#186)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-12-22 11:32:49 +01:00
Arvindh 1fe2e74a74 NOISSUE - Implement Thing Delete (#179)
* add: delete function in things interface

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

* add: remove things

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

* fix: things event streams

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

* add: things delete test

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

* add: delete thing http transport

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

* add: delete thing sdk, sdk_test, cli

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

* gofumpt -ed

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

* add: openapi

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

* fix: things change status response

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

* add: openapi

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

* rename events: from thing delete to thing remove

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

* fix wordings

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

* fix wordings in openapi

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

* add: type check

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

* update open api yaml

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

* fix things mocks

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-20 19:55:38 +01:00
Felix Gateru a6dd160091 MG-149 - Fix leaking database errors (#183)
* fix: handle database errors in svc

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

* fix: add descriptive error to postgres errors

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

---------

Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2023-12-20 10:51:04 +01:00
Arvindh 648655036e NOISSUE - Implementation of Group removal (#161)
* add: group delete flow

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

* sync with master

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

* improved grpc error handling

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

* gofumpt -ed

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

* changed database unassign parent group id

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

* seperate event for delete group

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

* change group event name

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

* update channel remove events

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

* fix: channels event

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

* add: sdk, sdk_tet, cli

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

* fix: sdk mock

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

* mockery

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

* convert to inline case

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

* change in group delete flow

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

* change return error in delete

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

* add: openapi

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

* rename events: from channel delete to channel remove

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
2023-12-19 13:01:24 +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 aaf0756707 NOISSUE - Generate SDK Mocks (#127)
* fix(errors): Fix nil pointer error in NewSDKError

In the NewSDKError function, a check is added to handle the case where the input error is nil. Previously, if the error was nil, the function would panic. This fix ensures that the function returns nil instead of panicking when the input error is nil.

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

* feat(sdk-mock): Add mock functions for SDK testing

This commit adds a set of mock functions for the software development kit (SDK) to facilitate testing. These functions simulate the behavior of the actual functions in the SDK and have defined input parameters and return values. The code also includes error handling logic and checks for different return types.

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

* test: use sdk mocked interface

* feat(workflow): check for generated files

The commit modifies the check-proto GitHub workflow to check-generated files. It checks for changes in specific paths and verifies the protobuf files and generated mocks. The code also includes checking if the SDK mock is up to date, installing a tool, generating mocks, and displaying an error message if the mocks are different. The tool we use is: https://github.com/vektra/mockery.

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

* feat(mocks): Add copyright notice to mocks.go

Added a copyright notice to the mocks.go file in the pkg/sdk/go directory for clarity and attribution.

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

* feat(build): Add target for generating mocks

Added a new target to the Makefile for generating mocks using the mockery tool. The target checks if the mockery tool is installed and then runs the "go generate" command to generate mocks for the codebase..

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

* Improve error messages in check-generated-files.yml

In this commit, I have made changes to the check-generated-files.yml file. Specifically, I have updated the error messages to provide more information about the issue. Instead of simply stating that the proto file and generated Go file are out of sync, the error message now includes a more detailed explanation and a suggestion for resolving the issue. Additionally, I have also added error messages for the generated mocks for the SDK. These error messages provide information about the sync issue and suggest running the necessary commands to resolve it. This commit aims to improve the clarity of error messages and help developers quickly identify and fix sync issues in the codebase.

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 09:25:05 +01:00
Felix Gateru 8ea1042531 MG-31 - Make bootstrap tests pass (#97)
* Fix errors

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

* Fix bootstrap tests

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

* remove changes to Makefile

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

* Fix tests in streams

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

---------

Signed-off-by: felix.gateru <felix.gateru@gmail.com>
2023-12-01 10:27:52 +01:00
b1ackd0t 23618c172d NOISSUE - Fix Bootstrap Tests (#54)
* Fix Bootstrap Tests

Fix failing tests in bootstrap package

* fix(domains): align tests with domains
2023-11-21 13:53: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
b1ackd0t 44408395e6 NOISSUE - Fix renaming issues (#17)
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-11-02 14:48:13 +01:00
Dušan Borovčanin 254dbcd555 NOISSUE - Fix gRPC client naming (#22)
* Fix Auth gRPC server name

Signed-off-by: dborovcanin <dusan.borovcanin@abstractmachines.fr>

* Rename import aliases

Signed-off-by: dborovcanin <dusan.borovcanin@abstractmachines.fr>

* Rename issuer name to Magistrala

Signed-off-by: dborovcanin <dusan.borovcanin@abstractmachines.fr>

---------

Signed-off-by: dborovcanin <dusan.borovcanin@abstractmachines.fr>
Co-authored-by: dborovcanin <dusan.borovcanin@abstractmachines.fr>
2023-11-01 19:17:24 +01:00
dusanb94 7066101996 Rename Mainflux to Magistrala
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
2023-10-26 12:50:56 +02:00
b1ackd0t 43a263d7da NOISSUE - Introduce NATS Jetstream as Default ES (#1907)
* Refactor message broker implementation

This commit refactors the Nats message broker implementation to include pubsub options. These changes include:

- Adding `Option` func that takes in the URL and prefix
- Implement `WithStream` option which can create a different stream for nats stream
- Implement `WithExchange` option which can create a different exchaange for rabbitmq channel
- Implement `WithPrefix` option which allows to you change the publisher prefix

These changes improve the organization and readability of the codebase.

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

* Use redis URL to configure username, password and db

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

* Make event store configurable on dev deployment

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

* Fix adds options to messaging `PubSub` interface

Adding options to PubSub interface allows the use of messaging
package to do es.

The changes in this commit ensure that the code handles errors
properly and provides more informative error messages when
encountering unexpected types.

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

* Add NATS event publisher implementation

This commit adds the implementation of the NATS event publisher.

The NATS event publisher is responsible for publishing events
to a NATS messaging system. It uses the `messaging`
package to interact with the messaging system.

The implementation includes the following features:

- Publishing events to NATS using the `Publish` method.
- Marshaling events to JSON before publishing.
- Setting the message subject and headers based on the event.
- Handling errors during publishing.

This implementation is built with the `!rabbitmq` build tag,
which means it will only be compiled if the `rabbitmq` build tag
is not present.

The NATS event publisher is part of the Mainflux events package
and provides support for the Mainflux NATS events source service functionality.

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

* Add RabbitMQ event publisher implementation

This commit adds the implementation of the RabbitMQ event publisher.

The RabbitMQ event publisher is responsible for publishing events
to a RabbitMQ messaging system. It uses the `messaging`
package to interact with the messaging system.

The implementation includes the following features:

- Publishing events to RabbitMQ using the `Publish` method.
- Marshaling events to JSON before publishing.
- Setting the message subject and headers based on the event.
- Handling errors during publishing.

This implementation is built with the `rabbitmq` build tag,
which means it will only be compiled if the `rabbitmq` build tag
is present.

The RabbitMQ event publisher is part of the Mainflux events package
and provides support for the Mainflux RabbitMQ events source service functionality.

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

* Add configurable implementation for events store

This commit adds a new file `brokers_*.go` which contains the implementation for the different event store. The file includes functions for creating a new publisher and subscriber using different es store.

This commit also includes an `init` function that logs a message indicating that the binary was built using the respective package as the events store.

The purpose of this commit is to add support for alternative events store.

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

* Fix build flags

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

* Refactor Makefile and Semaphore configuration

The Makefile has been refactored to include the `MF_ES_STORE_TYPE` tag in the `go build` command. Additionally, the Semaphore configuration has been updated to include a new task for compiling with Redis as the broker type.

This commit addresses the need to compile the codebase with Redis as the event store type and includes the necessary changes in the Makefile and Semaphore configuration.

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

* Reduced due to memory on testing

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

* Fix tests for es

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

* Fix grammar

Co-authored-by: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com>
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>

* Fix linting

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

* feat(docker): update environment variables for message broker

The commit updates the environment variable `MF_ES_STORE_TYPE` in the `docker/.env` file. The variable is changed from `${MF_MQTT_BROKER_TYPE}` to `${MF_MESSAGE_BROKER_TYPE}` to accurately reflect the type of message broker being used. This change ensures that the correct message broker is configured for the Event Store.

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

* feat: Update docker environment variables

- Removed the unused MF_ES_URL variable in the .env file
- Updated the MF_ES_STORE_TYPE and MF_ES_STORE_URL variables in the .env file to match the MF_MESSAGE_BROKER_TYPE and MF_NATS_URL variables respectively

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

* Fix after rebase

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

* Add godocs for option parameters for brokers

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

* pass by value exchange and prefix names

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

* Rename option functions

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

* move variables to constants

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

* fix: option example comment

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

---------

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Co-authored-by: Sammy Kerata Oina <44265300+SammyOina@users.noreply.github.com>
2023-10-24 17:22:53 +02:00
b1ackd0t 5c270abe29 NOISSUE - Uncomment Code (#1926)
* Uncomment all code

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

* feat(linters): add godox and dupword linters

This commit adds two new linters, godox and dupword, to the linter configuration file (.golangci.yml). The godox linter checks for occurrences of TODO and FIXME comments in the codebase, helping to ensure that these comments are not forgotten or left unresolved. The dupword linter detects duplicate words in comments and strings, which can be a sign of typos or errors. These new linters will enhance the code quality and maintainability of the project.

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

* uncomment tests in /pkg/sdk/go/tokens_test.go

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

---------

Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-10-18 16:45:08 +02:00
b1ackd0t 46705d401f Sync events with docs (#1900)
Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
2023-10-18 10:31:38 +02:00
Dušan Borovčanin 3d3aa525a6 NOISSUE - Switch to Google Zanzibar Access control approach (#1919)
* Return Auth service

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update Compose to run with SpiceDB and Auth svc

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update auth gRPC API

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Remove Users' policies

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Move Groups to internal

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Use shared groups in Users

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Remove unused code

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Use pkg Groups in Things

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Remove Things groups

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Make imports consistent

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update Groups networking

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Remove things groups-specific API

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Move Things Clients to the root

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Move Clients to Users root

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Temporarily remove tracing

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Fix imports

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Add buffer config for gRPC

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update auth type for Things

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Use Auth for login

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Add temporary solution for refresh token

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update Tokenizer interface

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Updade tokens issuing

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Fix token issuing

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update JWT validator and refactor Tokenizer

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Rename access timeout

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Rename login to authenticate

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update Identify to use SubjectID

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Add Auth to Groups

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Use the Auth service for Groups

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update auth schema

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Fix Auth for Groups

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Add auth for addons (#14)

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

Speparate Login and Refresh tokens

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Merge authN and authZ requests for things

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Add connect and disconnect

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update sharing

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Fix policies addition and removal

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Update relation with roels

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Add gRPC to Things

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

Assign and Unassign members to group and Listing of Group members (#15)

* add auth for addons

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

* add assign and unassign to group

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

* add group incomplete repo implementation

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

* groups for users

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

* groups for users

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

* groups for users

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

* groups for users

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

---------

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

Move coap mqtt and ws policies to spicedb (#16)

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

Remove old policies

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

NOISSUE - Things authorize to return thingID (#18)

This commit modifies the authorize endpoint to the grpc endpoint to return thingID. The authorize endpoint allows adapters to get the publisher of the message.

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

Add Groups to users service (#17)

* add assign and unassign to group

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

* add group incomplete repo implementation

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

* groups for users

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

* groups for users

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

* groups for users

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

* groups for users

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

* groups for users stable 1

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

* groups for users stable 2

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

* groups for users & things

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

* Amend signature

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

* fix merge error

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* NOISSUE - Fix es code (#21)

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

* NOISSUE - Fix Bugs (#20)

* fix bugs

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

* fix bugs

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* NOISSUE - Test e2e (#19)

* fix: connect method

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

* fix: e2e

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

* fix changes in sdk and e2e

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

* feat(docker): remove unnecessary port mapping

Remove the port mapping for MQTT broker in the docker-compose.yml file.

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

* Enable group listing

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

* feat(responses): update ChannelsPage struct

The ChannelsPage struct in the responses.go file has been updated. The "Channels" field has been renamed to "Groups" to provide more accurate naming. This change ensures consistency and clarity in the codebase.

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

* feat(things): add UpdateClientSecret method

Add the UpdateClientSecret method to the things service. This method allows updating the client secret for a specific client identified by the provided token, id, and key parameters.

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

---------

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

* Use smaller buffers for gRPC

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Clean up tests (#22)

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

* Add Connect Disconnect endpoints (#23)

* fix bugs

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

* fix bugs

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

* fix list of things in a channel and Add connect disconnect endpoint

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

* fix list of things in a channel and Add connect disconnect endpoint

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Add: Things share with users (#25)

* fix list of things in a channel and Add connect disconnect endpoint

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

* add: things share with other users

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* NOISSUE - Rename gRPC Services (#24)

* Rename things and users auth service

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

* docs: add authorization docs for gRPC services

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

* Rename things and users grpc services

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

* Remove mainflux.env package

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

---------

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

* Add: Listing of things, channels, groups, users  (#26)

* add: listing of channels, users, groups, things

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

* add: listing of channels, users, groups, things

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

* add: listing of channels, users, groups, things

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

* add: listing of channels, users, groups, things

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* NOISSUE - Clean Up Users (#27)

* feat(groups): rename redis package to events

- Renamed the `redis` package to `events` in the `internal/groups` directory.
- Updated the file paths and names accordingly.
- This change reflects the more accurate purpose of the package and improves code organization.

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

* feat(auth): Modify identity method

Change request and response of identity method

Add accessToken and refreshToken to Token response

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

* clean up users, remove dead code

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

* feat(users): add unit tests for user service

This commit adds unit tests for the user service in the `users` package. The tests cover various scenarios and ensure the correct behavior of the service.

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

---------

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

* Add: List of user groups & removed repeating code in groups (#29)

* removed repeating code in list groups

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

* add: list of user group

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

* fix: otel handler operator name for endpoints

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

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* NOISSUE - Clean Up Things Service (#28)

* Rework things service

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

* add tests

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

---------

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

* NOISSUE - Clean Up Auth Service (#30)

* clean up auth service

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

* feat(auth): remove unused import

Remove the unused import of `emptypb` in `auth.pb.go`. This import is not being used in the codebase and can be safely removed.

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

---------

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

* NOISSUE - Update API docs (#31)

Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Remove TODO comments and cleanup the code

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

* Update dependenices

Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>

---------

Signed-off-by: Arvindh <arvindh91@gmail.com>
Signed-off-by: dusanb94 <dusan.borovcanin@mainflux.com>
Signed-off-by: Rodney Osodo <28790446+rodneyosodo@users.noreply.github.com>
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
Co-authored-by: b1ackd0t <28790446+rodneyosodo@users.noreply.github.com>
Co-authored-by: Arvindh <30824765+arvindh123@users.noreply.github.com>
2023-10-15 22:02:13 +02:00
b1ackd0t 28f4965d26 NOISSUE - Add Event Sourcing Package (#1897)
* Add event sourcing package

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Move producer to es package

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Use redis URL to configure username, password and db

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Change the redis subscriber interface

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Clean up publisher inaterface

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Update redis version

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Add tests

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Rename factory functions of events store

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Rename redis package to events package

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Remove unnecessary alias on redis event store

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Minor cosmetic changes

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Remove stream length from factory function

Set the default stream length to 1e9 in the events package. This is
because the stream length is not a required parameter in the factory
function. This commit also removes the stream length from the factory
function.

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Remove group Name on subscribing

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Refactor package consumer to reflect changes in service name

The package consumer in the bootstrap/events/consumer/doc.go file has been modified to reflect the changes in the service name. The service name has been updated from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service.

This commit modifies the package consumer in the bootstrap/events/consumer/doc.go file to update the service name from "Things" to "Bootstrap". This change ensures that the package accurately represents the events consumer for the Bootstrap service.

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Refactor main to remove go routines

Remove go routines from main when subscribing to events. This is because
the event handlers are already running in their own go routines.

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Move cache to seperate package

This commit moves the cache package to a seperate package. This is
because the cache package is not the same as events package. The cache
package is used to store the data in memory while the events package is
used to send events to the event bus.

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

* Make startPublishingRoutine private

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>

---------

Signed-off-by: Rodney Osodo <socials@rodneyosodo.com>
2023-09-20 12:12:17 +02:00