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

NOISSUE - Fix List Users Shared With Me and Mine #1844

Merged
merged 1 commit into from
Jul 13, 2023

Conversation

rodneyosodo
Copy link
Member

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

What does this do?

FIxes listing users that have been shared with me and that are mine i.e list users with ?visibility=all

Which issue(s) does this PR fix/relate to?

No issue. It is a bug fix

List any changes that modify/break current functionality

Listing all users previously listed all users

curl "http://localhost/users?visibility=all" -H Authorization:\ Bearer\ $USER2TOKEN
{
  "limit": 10,
  "total": 2,
  "users": [
    {
      "id": "4fd33d6a-c784-44f1-97aa-9784871cd62d",
      "name": "admin",
      "credentials": { "identity": "admin@example.com", "secret": "" },
      "metadata": { "role": "admin" },
      "created_at": "2023-07-04T07:58:12.448654Z",
      "updated_at": "0001-01-01T00:00:00Z",
      "status": "enabled"
    }, 
    {
      "id": "e5e140c8-8aa0-4aea-a1c5-5c8178505eb9",
      "name": "a",
      "owner": "4fd33d6a-c784-44f1-97aa-9784871cd62d",
      "credentials": { "identity": "a@example.com", "secret": "" },
      "created_at": "2023-07-04T09:31:16.861607Z",
      "updated_at": "0001-01-01T00:00:00Z",
      "status": "enabled"
    }
  ]
}

instead of listing only shared users and users that are mine

curl "http://localhost/users?visibility=all" -H Authorization:\ Bearer\ $USER2TOKEN
{
  "limit": 10,
  "total": 1,
  "users": [
    {
      "id": "e5e140c8-8aa0-4aea-a1c5-5c8178505eb9",
      "name": "a",
      "owner": "4fd33d6a-c784-44f1-97aa-9784871cd62d",
      "credentials": { "identity": "a@example.com", "secret": "" },
      "created_at": "2023-07-04T09:31:16.861607Z",
      "updated_at": "0001-01-01T00:00:00Z",
      "status": "enabled"
    }
  ]
}

Have you included tests for your changes?

No

Did you document any new/modified functionality?

No

Notes

Steps to reproduce it are:

  1. Create 2 users
  2. Create 1 group
  3. Add the 2 users to the group with c_list properties
  4. Try listing users when you are user 2 or user 1

To be merged after https://github.com/mainflux/mainflux/pull/1843

@rodneyosodo rodneyosodo requested a review from a team as a code owner July 4, 2023 10:18
@codecov
Copy link

codecov bot commented Jul 4, 2023

Codecov Report

Merging #1844 (a4d10e9) into master (031e0a6) will increase coverage by 1.56%.
The diff coverage is 0.00%.

❗ Current head a4d10e9 differs from pull request most recent head 370ef38. Consider uploading reports for the commit 370ef38 to get more accurate results

@@            Coverage Diff             @@
##           master    #1844      +/-   ##
==========================================
+ Coverage   64.12%   65.68%   +1.56%     
==========================================
  Files         118      116       -2     
  Lines        9642     9413     -229     
==========================================
  Hits         6183     6183              
+ Misses       2801     2572     -229     
  Partials      658      658              
Impacted Files Coverage Δ
users/clients/postgres/clients.go 68.13% <0.00%> (ø)

... and 3 files with indirect coverage changes

📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more

@rodneyosodo rodneyosodo force-pushed the NOISSUE-BUG-listshared branch 4 times, most recently from 048be25 to 8140926 Compare July 10, 2023 12:30
Copy link
Contributor

@drasko drasko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@rodneyosodo rodneyosodo force-pushed the NOISSUE-BUG-listshared branch 3 times, most recently from 1ccbe7c to d4812f2 Compare July 12, 2023 10:14
Signed-off-by: rodneyosodo <blackd0t@protonmail.com>
@dborovcanin dborovcanin merged commit f7ba155 into absmach:master Jul 13, 2023
2 of 3 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants