diff --git a/docs/api/api.rst b/docs/api/api.rst --- a/docs/api/api.rst +++ b/docs/api/api.rst @@ -155,9 +155,10 @@ OUTPUT:: lock ---- -Set locking state on given repository by given user. +Set locking state on given repository by given user. If userid param is skipped +, then it is set to id of user whos calling this method. This command can be executed only using api_key belonging to user with admin -rights. +rights or regular user that have admin or write access to repository. INPUT:: @@ -166,9 +167,8 @@ INPUT:: method : "lock" args : { "repoid" : "" - "userid" : "", + "userid" : "", "locked" : "" - } OUTPUT:: @@ -178,12 +178,47 @@ OUTPUT:: error : null +show_ip +------- + +Shows IP address as seen from RhodeCode server, together with all +defined IP addresses for given user. +This command can be executed only using api_key belonging to user with admin +rights. + +INPUT:: + + id : + api_key : "" + method : "show_ip" + args : { + "userid" : "", + } + +OUTPUT:: + + id : + result : { + "ip_addr_server": ", + "user_ips": [ + { + "ip_addr": "", + "ip_range": ["", ""], + }, + ... + ] + } + + error : null + + get_user -------- Get's an user by username or user_id, Returns empty result if user is not found. +If userid param is skipped it is set to id of user who is calling this method. This command can be executed only using api_key belonging to user with admin -rights. +rights, or regular users that cannot specify different userid than theirs INPUT:: @@ -192,7 +227,7 @@ INPUT:: api_key : "" method : "get_user" args : { - "userid" : "" + "userid" : "" } OUTPUT:: @@ -200,16 +235,17 @@ OUTPUT:: id : result: None if user does not exist or { - "user_id" : "", - "username" : "", - "firstname": "", - "lastname" : "", - "email" : "", - "emails": "", - "active" : "", - "admin" :  "", - "ldap_dn" : "", - "last_login": "", + "user_id" : "", + "username" : "", + "firstname": "", + "lastname" : "", + "email" : "", + "emails": "", + "ip_addresses": "", + "active" : "", + "admin" :  "", + "ldap_dn" : "", + "last_login": "", "permissions": { "global": ["hg.create.repository", "repository.read", @@ -241,16 +277,17 @@ OUTPUT:: id : result: [ { - "user_id" : "", - "username" : "", - "firstname": "", - "lastname" : "", - "email" : "", - "emails": "", - "active" : "", - "admin" :  "", - "ldap_dn" : "", - "last_login": "", + "user_id" : "", + "username" : "", + "firstname": "", + "lastname" : "", + "email" : "", + "emails": "", + "ip_addresses": "", + "active" : "", + "admin" :  "", + "ldap_dn" : "", + "last_login": "", }, … ] @@ -315,14 +352,14 @@ INPUT:: method : "update_user" args : { "userid" : "", - "username" : " = Optional", - "email" : " = Optional", - "password" : " = Optional", - "firstname" : " = Optional", - "lastname" : " = Optional", - "active" : " = Optional", - "admin" : " = Optional", - "ldap_dn" : " = Optional" + "username" : " = Optional(None)", + "email" : " = Optional(None)", + "password" : " = Optional(None)", + "firstname" : " = Optional(None)", + "lastname" : " = Optional(None)", + "active" : " = Optional(None)", + "admin" : " = Optional(None)", + "ldap_dn" : " = Optional(None)" } OUTPUT:: @@ -537,8 +574,9 @@ get_repo -------- Gets an existing repository by it's name or repository_id. Members will return -either users_group or user associated to that repository. This command can -be executed only using api_key belonging to user with admin rights. +either users_group or user associated to that repository. This command can be +executed only using api_key belonging to user with admin +rights or regular user that have at least read access to repository. INPUT:: @@ -555,29 +593,40 @@ OUTPUT:: id : result: None if repository does not exist or { - "repo_id" : "", - "repo_name" : "" - "repo_type" : "", - "clone_uri" : "", - "private": : "", - "created_on" : "", - "description" : "", - "landing_rev": "", - "owner": "", - "fork_of": "", + "repo_id" : "", + "repo_name" : "" + "repo_type" : "", + "clone_uri" : "", + "enable_downloads": "", + "enable_locking": "", + "enable_statistics": "", + "private": "", + "created_on" : "", + "description" : "", + "landing_rev": "", + "last_changeset": { + "author": "", + "date": "", + "message": "", + "raw_id": "", + "revision": "", + "short_id": "" + } + "owner": "", + "fork_of": "", "members" : [ { "type": "user", - "user_id" : "", - "username" : "", - "firstname": "", - "lastname" : "", - "email" : "", - "emails": "", - "active" : "", - "admin" :  "", - "ldap_dn" : "", - "last_login": "", + "user_id" : "", + "username" : "", + "firstname": "", + "lastname" : "", + "email" : "", + "emails": "", + "active" : "", + "admin" :  "", + "ldap_dn" : "", + "last_login": "", "permission" : "repository.(read|write|admin)" }, … @@ -597,8 +646,9 @@ OUTPUT:: get_repos --------- -Lists all existing repositories. This command can be executed only using api_key -belonging to user with admin rights +Lists all existing repositories. This command can be executed only using +api_key belonging to user with admin rights or regular user that have +admin, write or read access to repository. INPUT:: @@ -613,16 +663,19 @@ OUTPUT:: id : result: [ { - "repo_id" : "", - "repo_name" : "" - "repo_type" : "", - "clone_uri" : "", - "private": : "", - "created_on" : "", - "description" : "", - "landing_rev": "", - "owner": "", - "fork_of": "", + "repo_id" : "", + "repo_name" : "" + "repo_type" : "", + "clone_uri" : "", + "private": : "", + "created_on" : "", + "description" : "", + "landing_rev": "", + "owner": "", + "fork_of": "", + "enable_downloads": "", + "enable_locking": "", + "enable_statistics": "", }, … ] @@ -666,11 +719,12 @@ OUTPUT:: create_repo ----------- -Creates a repository. This command can be executed only using api_key -belonging to user with admin rights. -If repository name contains "/", all needed repository groups will be created. -For example "foo/bar/baz" will create groups "foo", "bar" (with "foo" as parent), -and create "baz" repository with "bar" as group. +Creates a repository. If repository name contains "/", all needed repository +groups will be created. For example "foo/bar/baz" will create groups +"foo", "bar" (with "foo" as parent), and create "baz" repository with +"bar" as group. This command can be executed only using api_key belonging to user with admin +rights or regular user that have create repository permission. Regular users +cannot specify owner parameter INPUT:: @@ -679,13 +733,16 @@ INPUT:: api_key : "" method : "create_repo" args: { - "repo_name" : "", - "owner" : "", - "repo_type" : "", - "description" : " = Optional('')", - "private" : " = Optional(False)", - "clone_uri" : " = Optional(None)", - "landing_rev" : " = Optional('tip')", + "repo_name" : "", + "owner" : "", + "repo_type" : " = Optional('hg')", + "description" : " = Optional('')", + "private" : " = Optional(False)", + "clone_uri" : " = Optional(None)", + "landing_rev" : " = Optional('tip')", + "enable_downloads": " = Optional(False)", + "enable_locking": " = Optional(False)", + "enable_statistics": " = Optional(False)", } OUTPUT:: @@ -694,26 +751,65 @@ OUTPUT:: result: { "msg": "Created new repository ``", "repo": { - "repo_id" : "", - "repo_name" : "" - "repo_type" : "", - "clone_uri" : "", - "private": : "", - "created_on" : "", - "description" : "", - "landing_rev": "", - "owner": "", - "fork_of": "", + "repo_id" : "", + "repo_name" : "" + "repo_type" : "", + "clone_uri" : "", + "private": : "", + "created_on" : "", + "description" : "", + "landing_rev": "", + "owner": "", + "fork_of": "", + "enable_downloads": "", + "enable_locking": "", + "enable_statistics": "", }, } error: null +fork_repo +--------- + +Creates a fork of given repo. In case of using celery this will +immidiatelly return success message, while fork is going to be created +asynchronous. This command can be executed only using api_key belonging to +user with admin rights or regular user that have fork permission, and at least +read access to forking repository. Regular users cannot specify owner parameter. + + +INPUT:: + + id : + api_key : "" + method : "fork_repo" + args: { + "repoid" : "", + "fork_name": "", + "owner": "", + "description": "", + "copy_permissions": "", + "private": "", + "landing_rev": "" + + } + +OUTPUT:: + + id : + result: { + "msg": "Created fork of `` as ``", + "success": true + } + error: null + + delete_repo ----------- -Deletes a repository. This command can be executed only using api_key -belonging to user with admin rights. +Deletes a repository. This command can be executed only using api_key belonging to user with admin +rights or regular user that have admin access to repository. INPUT::