-
Notifications
You must be signed in to change notification settings - Fork 12
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
allow multiple auth domains per company
STTNHUB-330
- Loading branch information
Showing
10 changed files
with
83 additions
and
27 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
# -*- coding: utf-8; -*- | ||
# This file is part of Superdesk. | ||
# For the full copyright and license information, please see the | ||
# AUTHORS and LICENSE files distributed with this source code, or | ||
# at https://www.sourcefabric.org/superdesk/license | ||
# | ||
# Author : petr | ||
# Creation: 2024-03-25 15:09 | ||
|
||
from superdesk.commands.data_updates import DataUpdate as _DataUpdate | ||
|
||
|
||
class DataUpdate(_DataUpdate): | ||
resource = "companies" | ||
|
||
def forwards(self, mongodb_collection, mongodb_database): | ||
for company in mongodb_collection.find({"auth_domain": {"$exists": True}}): | ||
if company["auth_domain"]: | ||
print("Updating company", company["_id"]) | ||
mongodb_collection.update_one( | ||
{"_id": company["_id"]}, {"$set": {"auth_domains": [company["auth_domain"]]}} | ||
) | ||
|
||
def backwards(self, mongodb_collection, mongodb_database): | ||
for company in mongodb_collection.find({"auth_domains.0": {"$exists": True}}): | ||
mongodb_collection.update_one( | ||
{"_id": company["_id"]}, {"$set": {"auth_domain": [company["auth_domains"][0]]}} | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters