MCPcopy Create free account
hub / github.com/adobe/Marinus / add_admin_to_group

Function add_admin_to_group

python3_cron_scripts/setup.py:246–262  ·  view source on GitHub ↗

This will add a new admin to a group. An admin has the authority to add additional members to the group. This functionality is intended for a future feature where additional sub-groups beyond admin and data-admin are supported.

(mongo_connector, username, group)

Source from the content-addressed store, hash-verified

244
245
246def add_admin_to_group(mongo_connector, username, group):
247 """
248 This will add a new admin to a group. An admin has the authority to add additional members to the group.
249 This functionality is intended for a future feature where additional sub-groups beyond admin and data-admin are supported.
250 """
251 user_collection = mongo_connector.get_users_connection()
252 group_collection = mongo_connector.get_groups_connection()
253 now = datetime.now()
254
255 user_exists = user_collection.count_documents({"userid": username})
256 if user_exists == 0:
257 print("User does not yet exist. Please create the user first.")
258 return
259
260 group_collection.update_one(
261 {"name": group}, {"$addToSet": {"admins": username}, "$set": {"updated": now}}
262 )
263
264
265def create_config_collection(mongo_collection):

Callers 1

mainFunction · 0.85

Calls 2

get_users_connectionMethod · 0.80
get_groups_connectionMethod · 0.80

Tested by

no test coverage detected