@@ -84,70 +84,28 @@ export default {
8484 methods: {
8585 async revokeAnonymous () {
8686 try {
87- await this .$kuzzle .security .updateRole (
88- ' anonymous' ,
89- {
90- controllers: {
91- ' *' : {
92- actions: {
93- ' *' : false ,
94- },
95- },
96- auth: {
97- actions: {
98- checkToken: true ,
99- getCurrentUser: true ,
100- getMyRights: true ,
101- login: true ,
102- },
103- },
104- server: {
105- actions: {
106- publicApi: true ,
107- openapi: true ,
108- },
109- },
110- },
111- },
112- { refresh: ' wait_for' },
113- );
114-
115- await this .$kuzzle .security .updateRole (
116- ' default' ,
117- {
118- controllers: {
119- ' *' : {
120- actions: {
121- ' *' : false ,
122- },
123- },
124- auth: {
125- actions: {
126- checkToken: true ,
127- getCurrentUser: true ,
128- getMyRights: true ,
129- logout: true ,
130- updateSelf: true ,
131- },
132- },
133- server: {
134- actions: {
135- publicApi: true ,
136- },
137- },
138- },
139- },
140- { refresh: ' wait_for' },
141- );
87+ await this .$kuzzle .query ({
88+ controller: ' security' ,
89+ action: ' restrictDefaultRights' ,
90+ });
14291 this .$router .go (this .$router .currentRoute );
14392 } catch (err) {
144- this .$log .error (err);
145- this .$bvToast .toast (' The complete error has been printed to the console.' , {
146- title: ' Ooops! Something went wrong while revoking Anonymous role.' ,
147- variant: ' danger' ,
148- toaster: ' b-toaster-bottom-right' ,
149- appendToast: true ,
150- });
93+ if (err .status == 404 ) {
94+ this .$bvToast .toast (' This action is not supported by your Kuzzle versions. You might need to upgrade.' , {
95+ title: ' Not supported!' ,
96+ variant: ' warning' ,
97+ toaster: ' b-toaster-bottom-right' ,
98+ appendToast: true ,
99+ });
100+ } else {
101+ this .$log .error (err);
102+ this .$bvToast .toast (' The complete error has been printed to the console.' , {
103+ title: ' Ooops! Something went wrong while revoking Anonymous role.' ,
104+ variant: ' danger' ,
105+ toaster: ' b-toaster-bottom-right' ,
106+ appendToast: true ,
107+ });
108+ }
151109 }
152110 },
153111 },
0 commit comments