#3701 Editing extra in sidetags
Merged a year ago by tkopecek. Opened a year ago by tkopecek.
tkopecek/koji issue3700  into  master

file modified
+14 -3
@@ -230,7 +230,8 @@ 

  

  

  @export

- def editSideTag(sidetag, debuginfo=None, rpm_macros=None, remove_rpm_macros=None):

+ def editSideTag(sidetag, debuginfo=None, rpm_macros=None, remove_rpm_macros=None, extra=None,

+                 remove_extra=None):

      """Restricted ability to modify sidetags, parent tag must have:

      sidetag_debuginfo_allowed: 1

      sidetag_rpm_macros_allowed: 1
@@ -255,6 +256,16 @@ 

      is_sidetag(sidetag, raise_error=True)

      is_sidetag_owner(sidetag, user, raise_error=True)

  

+     if ((extra is not None or remove_extra is not None) and

+             not (context.session.hasPerm('sidetag_admin') or context.session.hasPerm('admin'))):

+         raise koji.GenericError(

+             "Extra can be modified only with sidetag_admin or admin permissions.")

+ 

+     if extra is None:

+         extra = {}

+     if remove_extra is None:

+         remove_extra = []

+ 

      parent_id = readInheritanceData(sidetag['id'])[0]['parent_id']

      parent = get_tag(parent_id)

  
@@ -265,7 +276,7 @@ 

              and not parent['extra'].get('sidetag_rpm_macros_allowed'):

          raise koji.GenericError("RPM macros change is not allowed in parent tag.")

  

-     kwargs = {'extra': {}}

+     kwargs = {'extra': extra, 'remove_extra': remove_extra}

      if debuginfo is not None:

          kwargs['extra']['with_debuginfo'] = bool(debuginfo)

      if rpm_macros is not None:
@@ -274,7 +285,7 @@ 

              kwargs['extra']['rpm.macro.%s' % macro] = value

      if remove_rpm_macros is not None:

          convert_value(remove_rpm_macros, cast=list, check_only=True)

-         kwargs['remove_extra'] = ['rpm.macro.%s' % m for m in remove_rpm_macros]

+         kwargs['remove_extra'] += ['rpm.macro.%s' % m for m in remove_rpm_macros]

  

      _edit_tag(sidetag['id'], **kwargs)

  

sidetag_admin permission for editing sidetag's extra field

Metadata Update from @tkopecek:
- Pull-request tagged with: testing-ready

a year ago

Metadata Update from @mfilip:
- Pull-request tagged with: testing-done

a year ago

Commit 5ecc788 fixes this pull-request

Pull-Request has been merged by tkopecek

a year ago