File tree 1 file changed +15
-0
lines changed
1 file changed +15
-0
lines changed Original file line number Diff line number Diff line change @@ -87,6 +87,9 @@ if gitlab.GitlabObject not in getmro(cls):
87
87
die ("Unknown object: %s" % what )
88
88
89
89
if action == "create" :
90
+ if not cls .canCreate :
91
+ die ("%s objects can't be created" % what )
92
+
90
93
try :
91
94
o = cls (gl , d )
92
95
o .save ()
@@ -96,6 +99,9 @@ if action == "create":
96
99
sys .exit (0 )
97
100
98
101
elif action == "list" :
102
+ if not cls .canList :
103
+ die ("%s objects can't be listed" % what )
104
+
99
105
try :
100
106
l = cls .list (gl , ** d )
101
107
except Exception as e :
@@ -108,6 +114,9 @@ elif action == "list":
108
114
sys .exit (0 )
109
115
110
116
elif action == "get" :
117
+ if not cls .canGet :
118
+ die ("%s objects can't be retrieved" % what )
119
+
111
120
try :
112
121
id = d .pop ('id' )
113
122
except :
@@ -123,6 +132,9 @@ elif action == "get":
123
132
sys .exit (0 )
124
133
125
134
elif action == "delete" :
135
+ if not cls .canDelete :
136
+ die ("%s objects can't be deleted" % what )
137
+
126
138
try :
127
139
id = d .pop ('id' )
128
140
except :
@@ -141,6 +153,9 @@ elif action == "delete":
141
153
sys .exit (0 )
142
154
143
155
elif action == "update" :
156
+ if not cls .canDelete :
157
+ die ("%s objects can't be updated" % what )
158
+
144
159
try :
145
160
id = d .pop ('id' )
146
161
except :
You can’t perform that action at this time.
0 commit comments