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

Updated record set ownergroup id as none when zone is private #1321

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

Jay07GIT
Copy link
Member

@Jay07GIT Jay07GIT commented Oct 18, 2023

Fixes #1317.

Changes in this pull request:

  • Updated the code for record set owner group id as none when zone is private when user tries to update record set. This will helps the zone admin users to update the zone when its private.

@codecov
Copy link

codecov bot commented Oct 18, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (98f38b1) 92.05% compared to head (d6940e4) 92.05%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1321   +/-   ##
=======================================
  Coverage   92.05%   92.05%           
=======================================
  Files         177      177           
  Lines        7889     7889           
  Branches      253      227   -26     
=======================================
  Hits         7262     7262           
  Misses        627      627           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Jay07GIT Jay07GIT self-assigned this Oct 24, 2023
@Jay07GIT Jay07GIT added the area/api Items relating to the API label Oct 24, 2023
Copy link
Member

@nspadaccino nspadaccino left a comment

Choose a reason for hiding this comment

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

Using this scenario:

A shared zone is added to vinyl
A user from group A adds a record "foo" to that zone. That record is owned by group A.
The zone is later changed to from shared to private, with the owner group being set to group B.

Testing with these changes, a user from group B will be able to successfully update record "foo". And when you search "foo" in the recordset search, it shows up as being owned by group B. So the functionality in the portal looks good.
However, in the database, the record in the recordset table still shows group A as the owner_group_id, even though it says group B in the portal, which is a bit confusing.

I think as part of these changes we should update the entries in the database as well. Could we have the owner_group_id column update when the zone access type is changed

@Jay07GIT
Copy link
Member Author

Using this scenario:

A shared zone is added to vinyl
A user from group A adds a record "foo" to that zone. That record is owned by group A.
The zone is later changed to from shared to private, with the owner group being set to group B.

Testing with these changes, a user from group B will be able to successfully update record "foo". And when you search "foo" in the recordset search, it shows up as being owned by group B. So the functionality in the portal looks good. However, in the database, the record in the recordset table still shows group A as the owner_group_id, even though it says group B in the portal, which is a bit confusing.

I think as part of these changes we should update the entries in the database as well. Could we have the owner_group_id column update when the zone access type is changed

Nice finding. I noticed it. This is done intentionally because if if we update the DB then when user wants to change zone from private to shared, then the pre - owned records will be updated. It might get confused again right?

If we still want to update the DB, we can.

Copy link
Member

@Aravindh-Raju Aravindh-Raju left a comment

Choose a reason for hiding this comment

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

Few changes, looks good otherwise!

Also, as nick mentioned, we should update the group id to the db too since we have a column provisioned for that. We can do that in a separate PR if it involves too much of changes though.

@@ -659,6 +660,16 @@ class RecordSetServiceIntegrationSpec
Some(group2.id)
}

"update successfully for private zone if user is updating record set when record set is already owned by another group were user is not a part of" in {
Copy link
Member

Choose a reason for hiding this comment

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

A small typo here. Should be where instead of were.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the code.

@@ -184,6 +184,7 @@ class RecordSetService(
).toResult
_ <- if(existing.name == rsForValidations.name) ().toResult else if(allowedZoneList.contains(zone.name)) checkAllowedDots(allowedDotsLimit, rsForValidations, zone).toResult else ().toResult
_ <- if(allowedZoneList.contains(zone.name)) isNotApexEndsWithDot(rsForValidations, zone).toResult else ().toResult

Copy link
Member

Choose a reason for hiding this comment

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

Can remove this new line here.

Copy link
Member Author

Choose a reason for hiding this comment

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

Removed the new line

@@ -887,6 +887,51 @@ class RecordSetServiceSpec
result.changeType shouldBe RecordSetChangeType.Update
result.status shouldBe RecordSetChangeStatus.Pending
}

"return the recordSet change as the result for private zone if user is updating record set " +
"when record set is already owned by another group were user is not a part of" in {
Copy link
Member

Choose a reason for hiding this comment

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

Typo here too. were should be replaced by where.

Copy link
Member Author

Choose a reason for hiding this comment

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

Updated the code.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area/api Items relating to the API
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Users can lose access to certain records if a zone is changed from shared to private
3 participants