mirror of
https://github.com/openSUSE/osc.git
synced 2025-01-22 21:16:16 +01:00
add option to request the additon of a group to a project or package and rename add_role to add_user to make the difference obvious.
This commit is contained in:
parent
2d5b853aa0
commit
c226327ae5
1
NEWS
1
NEWS
@ -2,6 +2,7 @@
|
||||
- add blt and rblt commands, aka "buildlogtail" and "remotebuildlogtail" to show
|
||||
just the end of a build log (for getting the fail reason faster).
|
||||
CHANGE: the --start parameter is now called --offset
|
||||
- add "createrequest -a add_group" option to create a group request
|
||||
- add "createrequest -a add_me" shortcut
|
||||
|
||||
0.130
|
||||
|
@ -1264,7 +1264,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
return actionxml
|
||||
|
||||
def _add_role(self, args, opts):
|
||||
def _add_user(self, args, opts):
|
||||
if len(args) > 4:
|
||||
raise oscerr.WrongArgs('Too many arguments.')
|
||||
if len(args) < 3:
|
||||
@ -1288,6 +1288,30 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
return actionxml
|
||||
|
||||
def _add_group(self, args, opts):
|
||||
if len(args) > 4:
|
||||
raise oscerr.WrongArgs('Too many arguments.')
|
||||
if len(args) < 3:
|
||||
raise oscerr.WrongArgs('Too few arguments.')
|
||||
|
||||
apiurl = self.get_api_url()
|
||||
|
||||
group = args[0]
|
||||
role = args[1]
|
||||
project = args[2]
|
||||
actionxml = """ <action type="add_role"> <target project="%s" /> <group name="%s" role="%s" /> </action> """ % \
|
||||
(project, group, role)
|
||||
|
||||
if len(args) > 3:
|
||||
package = args[3]
|
||||
actionxml = """ <action type="add_role"> <target project="%s" package="%s" /> <group name="%s" role="%s" /> </action> """ % \
|
||||
(project, package, group, role)
|
||||
|
||||
if get_group(apiurl, group) == None:
|
||||
raise oscerr.WrongArgs('osc: an error occured.')
|
||||
|
||||
return actionxml
|
||||
|
||||
def _set_bugowner(self, args, opts):
|
||||
if len(args) > 3:
|
||||
raise oscerr.WrongArgs('Too many arguments.')
|
||||
@ -1340,6 +1364,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
-a delete PROJECT [PACKAGE]
|
||||
-a change_devel PROJECT PACKAGE DEVEL_PROJECT [DEVEL_PACKAGE]
|
||||
-a add_me ROLE PROJECT [PACKAGE]
|
||||
-a add_group GROUP ROLE PROJECT [PACKAGE]
|
||||
-a add_role USER ROLE PROJECT [PACKAGE]
|
||||
-a set_bugowner USER PROJECT [PACKAGE]
|
||||
]
|
||||
@ -1387,9 +1412,13 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
args = opts.actiondata[i]
|
||||
actionsxml += self._add_me(args,opts)
|
||||
i = i+1
|
||||
elif ai == 'add_group':
|
||||
args = opts.actiondata[i]
|
||||
actionsxml += self._add_group(args,opts)
|
||||
i = i+1
|
||||
elif ai == 'add_role':
|
||||
args = opts.actiondata[i]
|
||||
actionsxml += self._add_role(args,opts)
|
||||
actionsxml += self._add_user(args,opts)
|
||||
i = i+1
|
||||
elif ai == 'set_bugowner':
|
||||
args = opts.actiondata[i]
|
||||
@ -1459,7 +1488,7 @@ Please submit there instead, or use --nodevelproject to force direct submission.
|
||||
|
||||
arg = [ user, opts.role, project, package ]
|
||||
|
||||
actionsxml = self._add_role(arg, None)
|
||||
actionsxml = self._add_user(arg, None)
|
||||
|
||||
if not opts.message:
|
||||
opts.message = edit_message()
|
||||
|
@ -3655,6 +3655,15 @@ def get_request_log(apiurl, reqid):
|
||||
return data
|
||||
|
||||
|
||||
def get_group(apiurl, group):
|
||||
u = makeurl(apiurl, ['group', quote_plus(group)])
|
||||
try:
|
||||
f = http_GET(u)
|
||||
return ''.join(f.readlines())
|
||||
except urllib2.HTTPError:
|
||||
print 'user \'%s\' not found' % group
|
||||
return None
|
||||
|
||||
def get_user_meta(apiurl, user):
|
||||
u = makeurl(apiurl, ['person', quote_plus(user)])
|
||||
try:
|
||||
|
Loading…
Reference in New Issue
Block a user