Parcourir la source

Изменения механизма ограничения доступа

Book Pauk il y a 2 ans
Parent
commit
abb3baf94b

+ 5 - 0
client/components/Api/Api.vue

@@ -262,6 +262,11 @@ class Api {
     async getConfig() {
         return await this.request({action: 'get-config'});
     }
+
+    async logout() {
+        await this.request({action: 'logout'});
+        await this.request({action: 'test'});
+    }
 }
 
 export default vueComponent(Api);

+ 12 - 0
client/components/Search/Search.vue

@@ -46,6 +46,14 @@
                             </q-tooltip>
                         </template>
                     </DivBtn>
+
+                    <DivBtn v-if="!config.freeAccess" class="q-ml-sm text-white bg-secondary" :size="30" :icon-size="24" :imt="1" icon="la la-sign-out-alt" round @click.stop.prevent="logout">
+                        <template #tooltip>
+                            <q-tooltip :delay="1500" anchor="bottom middle" content-style="font-size: 80%" max-width="400px">
+                                Выход
+                            </q-tooltip>
+                        </template>
+                    </DivBtn>
                 </div>
                 <div class="row q-mx-md q-mb-xs items-center">
                     <DivBtn
@@ -979,6 +987,10 @@ class Search {
     cloneSearch() {
         window.open(window.location.href, '_blank');
     }
+
+    async logout() {
+        await this.api.logout();
+    }
 }
 
 export default vueComponent(Search);

+ 1 - 0
server/controllers/WebSocketController.js

@@ -170,6 +170,7 @@ class WebSocketController {
     async getConfig(req, ws) {
         const config = _.pick(this.config, this.config.webConfigParams);
         config.dbConfig = await this.webWorker.dbConfig();
+        config.freeAccess = this.freeAccess;
 
         this.send(config, req, ws);
     }