diff docs/api/api.rst @ 2070:87f0800abc7b beta

#227 Initial version of repository groups permissions system - implemented none/read/write/admin permissions for groups - wrote more tests for permissions, and new permissions groups - a lot of code garden, splitted logic into proper models - permissions on groups doesn't propagate yet to repositories - deprecated some methods on api for managing permissions on repositories for users, and users groups
author Marcin Kuzminski <marcin@python-works.com>
date Sat, 28 Jan 2012 01:06:29 +0200
parents 4ae17f819ee8
children 0f87c784756e
line wrap: on
line diff
--- a/docs/api/api.rst	Sun Feb 05 21:45:15 2012 +0200
+++ b/docs/api/api.rst	Sat Jan 28 01:06:29 2012 +0200
@@ -91,6 +91,7 @@
 This command can be executed only using api_key belonging to user with admin 
 rights.
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -122,6 +123,7 @@
 Lists all existing users. This command can be executed only using api_key
 belonging to user with admin rights.
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -145,12 +147,14 @@
             ]
     error:  null
 
+
 create_user
 -----------
 
 Creates new user or updates current one if such user exists. This command can 
 be executed only using api_key belonging to user with admin rights.
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -174,12 +178,14 @@
             }
     error:  null
 
+
 get_users_group
 ---------------
 
 Gets an existing users group. This command can be executed only using api_key
 belonging to user with admin rights.
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -210,12 +216,14 @@
              }
     error : null
 
+
 get_users_groups
 ----------------
 
 Lists all existing users groups. This command can be executed only using 
 api_key belonging to user with admin rights.
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -253,6 +261,7 @@
 Creates new users group. This command can be executed only using api_key
 belonging to user with admin rights
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -270,12 +279,14 @@
             }
     error:  null
 
+
 add_user_to_users_group
 -----------------------
 
 Adds a user to a users group. This command can be executed only using api_key
 belonging to user with admin rights
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -293,12 +304,14 @@
             }
     error:  null
 
+
 get_repo
 --------
 
 Gets an existing repository. This command can be executed only using api_key
 belonging to user with admin rights
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -338,12 +351,14 @@
             }
     error:  null
 
+
 get_repos
 ---------
 
 Lists all existing repositories. This command can be executed only using api_key
 belonging to user with admin rights
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -372,6 +387,7 @@
 `dirs`. This command can be executed only using api_key belonging to user 
 with admin rights
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -395,7 +411,6 @@
     error:  null
 
 
-
 create_repo
 -----------
 
@@ -405,6 +420,7 @@
 For example "foo/bar/baz" will create groups "foo", "bar" (with "foo" as parent),
 and create "baz" repository with "bar" as group.
 
+
 INPUT::
 
     api_key : "<api_key>"
@@ -420,54 +436,106 @@
 OUTPUT::
 
     result: {
-                "id": "<newrepoid>",
-                "msg": "Created new repository <reponame>",
+              "id": "<newrepoid>",
+              "msg": "Created new repository <reponame>",
             }
     error:  null
 
-add_user_to_repo
-----------------
+
+grant_user_permission
+---------------------
 
-Add a user to a repository. This command can be executed only using api_key
-belonging to user with admin rights.
-If "perm" is None, user will be removed from the repository.
+Grant permission for user on given repository, or update existing one
+if found. This command can be executed only using api_key belonging to user 
+with admin rights.
+
 
 INPUT::
 
     api_key : "<api_key>"
-    method :  "add_user_to_repo"
+    method :  "grant_user_permission"
     args:     {
                 "repo_name" :  "<reponame>",
                 "username" :   "<username>",
-                "perm" :       "(None|repository.(read|write|admin))",
+                "perm" :       "(repository.(none|read|write|admin))",
+              }
+
+OUTPUT::
+
+    result: {
+              "msg" : "Granted perm: <perm> for user: <username> in repo: <reponame>"
+            }
+    error:  null
+
+
+revoke_user_permission
+----------------------
+
+Revoke permission for user on given repository. This command can be executed 
+only using api_key belonging to user with admin rights.
+
+
+INPUT::
+
+    api_key : "<api_key>"
+    method  : "revoke_user_permission"
+    args:     {
+                "repo_name" :  "<reponame>",
+                "username" :   "<username>",
               }
 
 OUTPUT::
 
     result: {
-                "msg" : "Added perm: <perm> for <username> in repo: <reponame>"
+              "msg" : "Revoked perm for user: <suername> in repo: <reponame>"
             }
     error:  null
 
-add_users_group_to_repo
------------------------
+
+grant_users_group_permission
+----------------------------
 
-Add a users group to a repository. This command can be executed only using 
-api_key belonging to user with admin rights. If "perm" is None, group will 
-be removed from the repository.
+Grant permission for users group on given repository, or update
+existing one if found. This command can be executed only using 
+api_key belonging to user with admin rights.
+
 
 INPUT::
 
     api_key : "<api_key>"
-    method :  "add_users_group_to_repo"
+    method :  "grant_users_group_permission"
+    args:     {
+                "repo_name" : "<reponame>",
+                "group_name" : "<usersgroupname>",
+                "perm" : "(repository.(none|read|write|admin))",
+              }
+
+OUTPUT::
+
+    result: {
+              "msg" : "Granted perm: <perm> for group: <usersgroupname> in repo: <reponame>"
+            }
+    error:  null
+    
+    
+revoke_users_group_permission
+-----------------------------
+
+Revoke permission for users group on given repository.This command can be 
+executed only using api_key belonging to user with admin rights.
+
+INPUT::
+
+    api_key : "<api_key>"
+    method  : "revoke_users_group_permission"
     args:     {
                 "repo_name" :  "<reponame>",
-                "group_name" : "<groupname>",
-                "perm" :       "(None|repository.(read|write|admin))",
+                "users_group" :   "<usersgroupname>",
               }
+
 OUTPUT::
-    
+
     result: {
-                "msg" : Added perm: <perm> for <groupname> in repo: <reponame>"
+              "msg" : "Revoked perm for group: <usersgroupname> in repo: <reponame>"
             }
-
+    error:  null
\ No newline at end of file