File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -87,6 +87,9 @@ if gitlab.GitlabObject not in getmro(cls):
8787 die ("Unknown object: %s" % what )
8888
8989if action == "create" :
90+ if not cls .canCreate :
91+ die ("%s objects can't be created" % what )
92+
9093 try :
9194 o = cls (gl , d )
9295 o .save ()
@@ -96,6 +99,9 @@ if action == "create":
9699 sys .exit (0 )
97100
98101elif action == "list" :
102+ if not cls .canList :
103+ die ("%s objects can't be listed" % what )
104+
99105 try :
100106 l = cls .list (gl , ** d )
101107 except Exception as e :
@@ -108,6 +114,9 @@ elif action == "list":
108114 sys .exit (0 )
109115
110116elif action == "get" :
117+ if not cls .canGet :
118+ die ("%s objects can't be retrieved" % what )
119+
111120 try :
112121 id = d .pop ('id' )
113122 except :
@@ -123,6 +132,9 @@ elif action == "get":
123132 sys .exit (0 )
124133
125134elif action == "delete" :
135+ if not cls .canDelete :
136+ die ("%s objects can't be deleted" % what )
137+
126138 try :
127139 id = d .pop ('id' )
128140 except :
@@ -141,6 +153,9 @@ elif action == "delete":
141153 sys .exit (0 )
142154
143155elif action == "update" :
156+ if not cls .canDelete :
157+ die ("%s objects can't be updated" % what )
158+
144159 try :
145160 id = d .pop ('id' )
146161 except :
You can’t perform that action at this time.
0 commit comments