def _check_group_auth(context, data_dict):
 if (not data_dict):
  return True
 model = context['model']
 user = context['user']
 pkg = context.get('package')
 api_version = (context.get('api_version') or '1')
 group_blobs = data_dict.get('groups', [])
 groups = set()
 for group_blob in group_blobs:
  if isinstance(group_blob, dict):
   id = (group_blob.get('id') or group_blob.get('name'))
   if (not id):
    continue
  else:
   id = group_blob
  grp = model.Group.get(id)
  if (grp is None):
   raise logic.NotFound(_('Group was not found.'))
  groups.add(grp)
 if pkg:
  pkg_groups = pkg.get_groups()
  groups = (groups - set(pkg_groups))
 for group in groups:
  if (not authz.has_user_permission_for_group_or_org(group.id, user, 'update')):
   return False
 return True

def _check_group_auth ( context , data_dict ) : if ( not data_dict ) : return True model = context [ 'model' ] user = context [ 'user' ] pkg = context . get ( 'package' ) api_version = ( context . get ( 'api_version' ) or '1' ) group_blobs = data_dict . get ( 'groups' , [ ] ) groups = set ( ) for group_blob in group_blobs : if isinstance ( group_blob , dict ) : id = ( group_blob . get ( 'id' ) or group_blob . get ( 'name' ) ) if ( not id ) : continue else : id = group_blob grp = model . Group . get ( id ) if ( grp is None ) : raise logic . NotFound ( _ ( 'Group was not found.' ) ) groups . add ( grp ) if pkg : pkg_groups = pkg . get_groups ( ) groups = ( groups - set ( pkg_groups ) ) for group in groups : if ( not authz . has_user_permission_for_group_or_org ( group . id , user , 'update' ) ) : return False return True
has this user got update permission for all of the given groups? if there is a package in the context then ignore that packages groups .