@@ -172,7 +172,8 @@ def _save_updated_perms(
172172 print ()
173173 show_perms (supplier_type , app_id , org_ods )
174174
175- print ("💡 Remember to update the lambda layer for these changes to take effect" )
175+ print ()
176+ print ("💡 Remember to update the lambda layer for these changes to take effect 💡" )
176177 print ()
177178
178179
@@ -415,12 +416,16 @@ def add_perm(
415416 item for item in items_to_add if item in current_permission_items
416417 ]
417418 if already_added_items :
418- print (
419- f"❌ Error: Unable to add { permission_name } . These { permission_name } are already assigned to { lookup_path } :"
420- )
419+ if len (already_added_items ) == len (items_to_add ):
420+ print (
421+ f"⏭️ Skipping: All requested { permission_name } are already assigned to { lookup_path } "
422+ )
423+ print ()
424+ return
425+
426+ print (f"👬 Skipping { permission_name } already assigned to { lookup_path } :" )
421427 _print_perm_with_lookup ("" , already_added_items , permission_lookup )
422428 print ()
423- return
424429
425430 proposed_permission_items = current_permission_items + list (items_to_add )
426431 _print_perm_with_lookup (
@@ -497,17 +502,20 @@ def remove_perm(
497502 current_perms = json .loads (perms_ugly )
498503 current_permission_items : list = current_perms .get (permission_key , [])
499504
500- # Cannot remove permission items that aren't already assigned
501505 items_not_assigned = [
502506 item for item in items_to_remove if item not in current_permission_items
503507 ]
504508 if items_not_assigned :
505- print (
506- f"❌ Error: Unable to remove { permission_name } . These { permission_name } aren't assigned to { lookup_path } :"
507- )
509+ if len (items_not_assigned ) == len (items_to_remove ):
510+ print (
511+ f"⏭️ Skipping: None of the requested { permission_name } are assigned to { lookup_path } "
512+ )
513+ print ()
514+ return
515+
516+ print (f"👬 Skipping { permission_name } not already assigned to { lookup_path } :" )
508517 _print_perm ("" , items_not_assigned )
509518 print ()
510- return
511519
512520 proposed_permission_items = [
513521 item for item in current_permission_items if item not in items_to_remove
@@ -547,7 +555,7 @@ def clear_perms(supplier_type: SupplierType, app_id: str, org_ods=None) -> None:
547555 current_perms = _get_perms_from_s3 (lookup_path )
548556 if not current_perms or current_perms == "{}" :
549557 print (
550- f"⏭️ No need to clear permissions for { lookup_path } as it currently has no permissions set."
558+ f"⏭️ No need to clear permissions for { lookup_path } as it currently has no permissions set."
551559 )
552560 return
553561
0 commit comments