From ccffbb9247421a64ceceb82d63aff0b92b9c3928 Mon Sep 17 00:00:00 2001
From: tanzhicong <15819701427@163.com>
Date: Thu, 30 Jul 2020 16:17:05 +0800
Subject: [PATCH 1/5] =?UTF-8?q?=E5=AE=8C=E6=88=90=E9=9C=80=E6=B1=82apps/pe?=
=?UTF-8?q?rmissions=20-=20permission-on-organization-user-blocking=20#581?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.idea/TUGithubAPI.iml | 8 +++++
.../inspectionProfiles/profiles_settings.xml | 6 ++++
.idea/modules.xml | 8 +++++
.idea/workspace.xml | 4 +++
api/apps/permissions.py | 34 +++++++++++++++++++
5 files changed, 60 insertions(+)
create mode 100644 .idea/TUGithubAPI.iml
create mode 100644 .idea/inspectionProfiles/profiles_settings.xml
create mode 100644 .idea/modules.xml
create mode 100644 .idea/workspace.xml
create mode 100644 api/apps/permissions.py
diff --git a/.idea/TUGithubAPI.iml b/.idea/TUGithubAPI.iml
new file mode 100644
index 0000000..d9e6024
--- /dev/null
+++ b/.idea/TUGithubAPI.iml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
new file mode 100644
index 0000000..105ce2d
--- /dev/null
+++ b/.idea/inspectionProfiles/profiles_settings.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/modules.xml b/.idea/modules.xml
new file mode 100644
index 0000000..1e8455b
--- /dev/null
+++ b/.idea/modules.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
new file mode 100644
index 0000000..1ba2a82
--- /dev/null
+++ b/.idea/workspace.xml
@@ -0,0 +1,4 @@
+
+
+
+
\ No newline at end of file
diff --git a/api/apps/permissions.py b/api/apps/permissions.py
new file mode 100644
index 0000000..ee6bc32
--- /dev/null
+++ b/api/apps/permissions.py
@@ -0,0 +1,34 @@
+from core.rest_client import RestClient
+
+
+class Permissions(RestClient):
+ def __init__(self, api_root_url, **kwargs):
+ super(Permissions, self).__init__(api_root_url, **kwargs)
+
+ def list_users_blocked_by_an_oragnization(self, org, **kwargs):
+ """
+ https://developer.github.com/v3/orgs/blocking/#list-users-blocked-by-an-organization
+ """
+ headers = {"accept": "application/vnd.github.giant-sentry-fist-preview+json"}
+ return self.get("/orgs/{}/blocks".format(org), **kwargs, headers=headers)
+
+ def check_if_a_user_is_blocked_by_an_organization(self, org, username, **kwargs):
+ """
+ https://developer.github.com/v3/orgs/blocking/#check-if-a-user-is-blocked-by-an-organization
+ """
+ headers = {"accept": "application/vnd.github.giant-sentry-fist-preview+json"}
+ return self.get("/orgs/{}/blocks/{}".format(org, username), **kwargs, headers=headers)
+
+ def block_a_user_from_an_organization(self,org, username, **kwargs):
+ """
+ https://developer.github.com/v3/orgs/blocking/#block-a-user-from-an-organization
+ """
+ headers = {"accept": "application/vnd.github.giant-sentry-fist-preview+json"}
+ return self.put("/orgs/{}/blocks/{}".format(org, username), headers=headers, **kwargs)
+
+ def unblock_a_user_from_an_organization(self, org, username, **kwargs):
+ """
+ https://developer.github.com/v3/orgs/blocking/#unblock-a-user-from-an-organization
+ """
+ headers = {"accept": "application/vnd.github.giant-sentry-fist-preview+json"}
+ return self.delete("/orgs/{}/blocks/{}".format(org, username), headers=headers, **kwargs)
\ No newline at end of file
From 5e1bfc8503fddd1e5c03c9925e91132e3cd63a10 Mon Sep 17 00:00:00 2001
From: Clarence <58550339+tanzhicong@users.noreply.github.com>
Date: Thu, 30 Jul 2020 16:31:38 +0800
Subject: [PATCH 2/5] Delete TUGithubAPI.iml
---
.idea/TUGithubAPI.iml | 8 --------
1 file changed, 8 deletions(-)
delete mode 100644 .idea/TUGithubAPI.iml
diff --git a/.idea/TUGithubAPI.iml b/.idea/TUGithubAPI.iml
deleted file mode 100644
index d9e6024..0000000
--- a/.idea/TUGithubAPI.iml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
From 1d90d0983e51173d0760c0fd05bd40b4b555016c Mon Sep 17 00:00:00 2001
From: Clarence <58550339+tanzhicong@users.noreply.github.com>
Date: Thu, 30 Jul 2020 16:31:50 +0800
Subject: [PATCH 3/5] Delete profiles_settings.xml
---
.idea/inspectionProfiles/profiles_settings.xml | 6 ------
1 file changed, 6 deletions(-)
delete mode 100644 .idea/inspectionProfiles/profiles_settings.xml
diff --git a/.idea/inspectionProfiles/profiles_settings.xml b/.idea/inspectionProfiles/profiles_settings.xml
deleted file mode 100644
index 105ce2d..0000000
--- a/.idea/inspectionProfiles/profiles_settings.xml
+++ /dev/null
@@ -1,6 +0,0 @@
-
-
-
-
-
-
\ No newline at end of file
From b01e8bd180c0aae39e27148ea37351cd574ea53f Mon Sep 17 00:00:00 2001
From: Clarence <58550339+tanzhicong@users.noreply.github.com>
Date: Thu, 30 Jul 2020 16:32:01 +0800
Subject: [PATCH 4/5] Delete modules.xml
---
.idea/modules.xml | 8 --------
1 file changed, 8 deletions(-)
delete mode 100644 .idea/modules.xml
diff --git a/.idea/modules.xml b/.idea/modules.xml
deleted file mode 100644
index 1e8455b..0000000
--- a/.idea/modules.xml
+++ /dev/null
@@ -1,8 +0,0 @@
-
-
-
-
-
-
-
-
\ No newline at end of file
From 10e7cffef6242ca3cfafe05384f08d548c8756cb Mon Sep 17 00:00:00 2001
From: Clarence <58550339+tanzhicong@users.noreply.github.com>
Date: Thu, 30 Jul 2020 16:32:10 +0800
Subject: [PATCH 5/5] Delete workspace.xml
---
.idea/workspace.xml | 4 ----
1 file changed, 4 deletions(-)
delete mode 100644 .idea/workspace.xml
diff --git a/.idea/workspace.xml b/.idea/workspace.xml
deleted file mode 100644
index 1ba2a82..0000000
--- a/.idea/workspace.xml
+++ /dev/null
@@ -1,4 +0,0 @@
-
-
-
-
\ No newline at end of file