diff --git a/cmd/agent/app/config/config.go b/cmd/agent/app/config/config.go index 5296d5aaf7c06d328391d5bb39d56087014d88d3..1d81a86c69f09261de1647d5a5570882e87cc6bd 100644 --- a/cmd/agent/app/config/config.go +++ b/cmd/agent/app/config/config.go @@ -1,18 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: yangzhao1 - * Date: 2022-04-05 10:28:34 - * LastEditTime: 2022-04-06 15:08:42 - * Description: provide agent log manager of pilotgo - ******************************************************************************/ - +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package config import ( diff --git a/cmd/agent/app/filemonitor/filemonitor.go b/cmd/agent/app/filemonitor/filemonitor.go index 7b6496801d2d58a62b649ca7d2c4973adf62ccbd..e536540d04f3797f8193d08979a64a3426b9a1ae 100644 --- a/cmd/agent/app/filemonitor/filemonitor.go +++ b/cmd/agent/app/filemonitor/filemonitor.go @@ -1,111 +1,104 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-07-05 13:03:16 - * LastEditTime: 2023-02-21 19:02:55 - * Description: file monitor init - ******************************************************************************/ -package filemonitor - -import ( - "fmt" - "path" - "strings" - - "gitee.com/openeuler/PilotGo/cmd/agent/app/localstorage" - "gitee.com/openeuler/PilotGo/cmd/agent/app/network" - "gitee.com/openeuler/PilotGo/pkg/utils/message/protocol" - "gitee.com/openeuler/PilotGo/sdk/logger" - "github.com/fsnotify/fsnotify" - "github.com/google/uuid" -) - -// repo路径 -const RepoPath = "/etc/yum.repos.d" - -// 网络配置 -const NetWorkPath = "/etc/sysconfig/network-scripts" - -var RESP_MSG = make(chan interface{}) - -func FileMonitorInit() error { - // get agent uuid - uuid := localstorage.AgentUUID() - - // 1、NewWatcher 初始化一个 watcher - watcher, err := fsnotify.NewWatcher() - if err != nil { - return err - } - defer watcher.Close() - - // 2、使用 watcher 的 Add 方法增加需要监听的文件或目录到监听队列中 - err = watcher.Add(RepoPath) - if err != nil { - logger.Debug("failed to monitor repo") - } - logger.Info("start to monitor repo") - - err = watcher.Add(NetWorkPath) - if err != nil { - logger.Debug("failed to monitor network") - } - logger.Info("start to monitor network") - - //3、创建新的 goroutine,等待管道中的事件或错误 - done := make(chan bool) - go func() { - defer close(done) - for { - select { - case e, ok := <-watcher.Events: - if !ok { - return - } - fileExt := path.Ext(e.Name) - if strings.Contains(fileExt, ".sw") || strings.Contains(fileExt, "~") || strings.Contains(e.Name, "~") { - continue - } - - if e.Op&fsnotify.Write == fsnotify.Write { - RESP_MSG <- fmt.Sprintf("机器 %s 上的文件已被修改 : %s", uuid, e.Name) - } - - case err, ok := <-watcher.Errors: - if !ok { - return - } - logger.Error("error: %s", err) - } - } - }() - <-done - return nil -} - -func FileMonitor(client *network.SocketClient) { - for data := range RESP_MSG { - if data == nil { - continue - } - - msg := &protocol.Message{ - UUID: uuid.New().String(), - Type: protocol.FileMonitor, - Status: 0, - Data: data, - } - - if err := client.Send(msg); err != nil { - logger.Debug("send message failed, error: %s", err) - } - - } -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package filemonitor + +import ( + "fmt" + "path" + "strings" + + "gitee.com/openeuler/PilotGo/cmd/agent/app/localstorage" + "gitee.com/openeuler/PilotGo/cmd/agent/app/network" + "gitee.com/openeuler/PilotGo/pkg/utils/message/protocol" + "gitee.com/openeuler/PilotGo/sdk/logger" + "github.com/fsnotify/fsnotify" + "github.com/google/uuid" +) + +// repo路径 +const RepoPath = "/etc/yum.repos.d" + +// 网络配置 +const NetWorkPath = "/etc/sysconfig/network-scripts" + +var RESP_MSG = make(chan interface{}) + +func FileMonitorInit() error { + // get agent uuid + uuid := localstorage.AgentUUID() + + // 1、NewWatcher 初始化一个 watcher + watcher, err := fsnotify.NewWatcher() + if err != nil { + return err + } + defer watcher.Close() + + // 2、使用 watcher 的 Add 方法增加需要监听的文件或目录到监听队列中 + err = watcher.Add(RepoPath) + if err != nil { + logger.Debug("failed to monitor repo") + } + logger.Info("start to monitor repo") + + err = watcher.Add(NetWorkPath) + if err != nil { + logger.Debug("failed to monitor network") + } + logger.Info("start to monitor network") + + //3、创建新的 goroutine,等待管道中的事件或错误 + done := make(chan bool) + go func() { + defer close(done) + for { + select { + case e, ok := <-watcher.Events: + if !ok { + return + } + fileExt := path.Ext(e.Name) + if strings.Contains(fileExt, ".sw") || strings.Contains(fileExt, "~") || strings.Contains(e.Name, "~") { + continue + } + + if e.Op&fsnotify.Write == fsnotify.Write { + RESP_MSG <- fmt.Sprintf("机器 %s 上的文件已被修改 : %s", uuid, e.Name) + } + + case err, ok := <-watcher.Errors: + if !ok { + return + } + logger.Error("error: %s", err) + } + } + }() + <-done + return nil +} + +func FileMonitor(client *network.SocketClient) { + for data := range RESP_MSG { + if data == nil { + continue + } + + msg := &protocol.Message{ + UUID: uuid.New().String(), + Type: protocol.FileMonitor, + Status: 0, + Data: data, + } + + if err := client.Send(msg); err != nil { + logger.Debug("send message failed, error: %s", err) + } + + } +} diff --git a/cmd/agent/app/global/global.go b/cmd/agent/app/global/global.go index f85eef97e083f8cf2ff74d8fee46b3a770311040..aae27344d9c83e7eaad7c01cd171b9f05f6b5d4f 100644 --- a/cmd/agent/app/global/global.go +++ b/cmd/agent/app/global/global.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package global import ( diff --git a/cmd/agent/app/localstorage/localstorage.go b/cmd/agent/app/localstorage/localstorage.go index 4ef09b4872e321cc75d5cf29fc4d073b6c701ec6..0802938e64073153513df269f7a8b21ba04ee506 100644 --- a/cmd/agent/app/localstorage/localstorage.go +++ b/cmd/agent/app/localstorage/localstorage.go @@ -1,18 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: yangzhao1 - * Date: 2022-04-13 15:11:03 - * LastEditTime: 2022-04-18 16:02:57 - * Description: provide agent log manager of pilotgo - ******************************************************************************/ - +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package localstorage import ( diff --git a/cmd/agent/app/network/client.go b/cmd/agent/app/network/client.go index 5632683edcea6a91f91acd86f423f4331da5bdd4..a6bf55fed5dfb48cbdff04a22a107ca3ae686dda 100644 --- a/cmd/agent/app/network/client.go +++ b/cmd/agent/app/network/client.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-01-24 15:08:08 - * LastEditTime: 2022-04-09 17:24:42 - * Description: provide agent service functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package network import ( diff --git a/cmd/agent/app/register/handler/command.go b/cmd/agent/app/register/handler/command.go index dfbab06438453cf0979d13b3e078c230bb1af1cc..7d8695ad87cb7b3c63e7f19d5f33a13f2787341e 100644 --- a/cmd/agent/app/register/handler/command.go +++ b/cmd/agent/app/register/handler/command.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/cron.go b/cmd/agent/app/register/handler/cron.go index 02d6496e72ead6c6c98145ed3dd88b5a5a99ee8b..a105183b154e8ad012a357f73c807b9b37190e56 100644 --- a/cmd/agent/app/register/handler/cron.go +++ b/cmd/agent/app/register/handler/cron.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/disk.go b/cmd/agent/app/register/handler/disk.go index 3c416080470ae8183f003bc1c0f6bf2e04acea13..eef321635265d1ed983000e6e93deab24f64c758 100644 --- a/cmd/agent/app/register/handler/disk.go +++ b/cmd/agent/app/register/handler/disk.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/file.go b/cmd/agent/app/register/handler/file.go index f134f02461870f98420b51414a29832358fb0671..92df2791c5971f2d23449b79a694770fea29119b 100644 --- a/cmd/agent/app/register/handler/file.go +++ b/cmd/agent/app/register/handler/file.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/firewall.go b/cmd/agent/app/register/handler/firewall.go index 4c421d54f48a9fa78b7c6869d6d6da90a3a29ca8..1838b750c5b5061522a245ab6243d173d6bc11a7 100644 --- a/cmd/agent/app/register/handler/firewall.go +++ b/cmd/agent/app/register/handler/firewall.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/machine.go b/cmd/agent/app/register/handler/machine.go index a0463b5274b5588910942398da48c272b46870aa..60b1e170652d913a951199e2afb5f5c548eb8a19 100644 --- a/cmd/agent/app/register/handler/machine.go +++ b/cmd/agent/app/register/handler/machine.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/network.go b/cmd/agent/app/register/handler/network.go index 41ff19cbc2bc562effaf42924b820660a467c50c..1f22d8a7484be0fa07ed451dfb56aa623b7a539e 100644 --- a/cmd/agent/app/register/handler/network.go +++ b/cmd/agent/app/register/handler/network.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/rpm.go b/cmd/agent/app/register/handler/rpm.go index edacf0a1d7ff6a772b92e29117d5e76073b3aee4..4ad437f870b06c7c9488462c2051e1f48401b67c 100644 --- a/cmd/agent/app/register/handler/rpm.go +++ b/cmd/agent/app/register/handler/rpm.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/service.go b/cmd/agent/app/register/handler/service.go index 67bc733b12b3501c67d2df20f335d534de875aca..3b0944820a1945444a040e6c81432788a8c61420 100644 --- a/cmd/agent/app/register/handler/service.go +++ b/cmd/agent/app/register/handler/service.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/sysctl.go b/cmd/agent/app/register/handler/sysctl.go index 8c95c130497d6840eb9511921ee0269c940e1b23..5f438bb357dd5f2a087df5ff33eb50ae07c58384 100644 --- a/cmd/agent/app/register/handler/sysctl.go +++ b/cmd/agent/app/register/handler/sysctl.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/handler/user.go b/cmd/agent/app/register/handler/user.go index 31d88213d1eb30abac6656cdcf17857f4ee3c22b..d0b3b2078a3f194b83f441fe34fc39a3042c4656 100644 --- a/cmd/agent/app/register/handler/user.go +++ b/cmd/agent/app/register/handler/user.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package handler import ( diff --git a/cmd/agent/app/register/registerhandler.go b/cmd/agent/app/register/registerhandler.go index a60f59ae3aa9d05afd914032760560127c54bd84..9487c775fa48b9aa8405bb2f485f0ce8e4a2088d 100644 --- a/cmd/agent/app/register/registerhandler.go +++ b/cmd/agent/app/register/registerhandler.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-07-05 13:03:16 - * LastEditTime: 2023-08-30 16:00:51 - * Description: socket client register - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package register import ( diff --git a/cmd/agent/main.go b/cmd/agent/main.go index bb5102fd3733ef3da3c17523423508da476922a3..0133c7bc34e0c0973031c63d265b8d6273210cf8 100644 --- a/cmd/agent/main.go +++ b/cmd/agent/main.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-11-18 10:25:52 - * LastEditTime: 2023-02-21 19:03:23 - * Description: agent main - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package main import ( diff --git a/cmd/server/app/agentmanager/agent.go b/cmd/server/app/agentmanager/agent.go index fdad9337ad93f2ffa8db3d2c658a6a2fa6cb0480..55082aaf54324e4aeb9b5aaa81d244620f3d5b8c 100644 --- a/cmd/server/app/agentmanager/agent.go +++ b/cmd/server/app/agentmanager/agent.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-18 02:33:55 - * LastEditTime: 2023-07-11 16:52:58 - * Description: socket server's agentmanager - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/agentmanager.go b/cmd/server/app/agentmanager/agentmanager.go index 56e28e5fb3919ef5c3af581f6d53de7a12476682..2f190f81729a3327cb3da96b6bfda518479d59ae 100644 --- a/cmd/server/app/agentmanager/agentmanager.go +++ b/cmd/server/app/agentmanager/agentmanager.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-01-18 02:33:55 - * LastEditTime: 2023-07-10 14:49:50 - * Description: socket server - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/cmd.go b/cmd/server/app/agentmanager/cmd.go index 3565bb86960bdc6f11449a71036765794f2fa096..0d71429d8055ac9c3fcd24b7a0b03950f4a677f9 100644 --- a/cmd/server/app/agentmanager/cmd.go +++ b/cmd/server/app/agentmanager/cmd.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/file.go b/cmd/server/app/agentmanager/file.go index 0936545e0138701a0995fde86657f8ebdb017530..508ff0a67485e6b1cef15b53cb0de6817b8684bb 100644 --- a/cmd/server/app/agentmanager/file.go +++ b/cmd/server/app/agentmanager/file.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/firewall.go b/cmd/server/app/agentmanager/firewall.go index fb81707afd86a0bae0c9ea595f5713f0148c05e0..5e21b244cdbfa0d9ce21078b1050af590a1bb4a9 100644 --- a/cmd/server/app/agentmanager/firewall.go +++ b/cmd/server/app/agentmanager/firewall.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/host.go b/cmd/server/app/agentmanager/host.go index 8c1b3ffd3589877c4bab632afd231148e41c53d2..8bb72f18327417cafb4c5050b35a7022a6bd580a 100644 --- a/cmd/server/app/agentmanager/host.go +++ b/cmd/server/app/agentmanager/host.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/network.go b/cmd/server/app/agentmanager/network.go index 59af274d3d273d19ce4aa3c048a821da6ce1c9a3..618b9bf0649e8ed86a1989999a3823504582cdaf 100644 --- a/cmd/server/app/agentmanager/network.go +++ b/cmd/server/app/agentmanager/network.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 +*/ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/rpm.go b/cmd/server/app/agentmanager/rpm.go index e2a0f35b8a46224d7f40065e9392328cc308f72f..c1f259a8544fdeef79054fad62618b43843d2e68 100644 --- a/cmd/server/app/agentmanager/rpm.go +++ b/cmd/server/app/agentmanager/rpm.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/service.go b/cmd/server/app/agentmanager/service.go index 1e95cbb122f3e0a34375d98702f4e2c16ad03b9d..2bc00686a0cc5ca72cc561c5ae6b48892e8971be 100644 --- a/cmd/server/app/agentmanager/service.go +++ b/cmd/server/app/agentmanager/service.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/agentmanager/user.go b/cmd/server/app/agentmanager/user.go index 8ab0071cd47d991eac6a56e23ce0f1399c737e39..1d9cda295a9244d0f2d39a06fe2becb6db841fa9 100644 --- a/cmd/server/app/agentmanager/user.go +++ b/cmd/server/app/agentmanager/user.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentmanager import ( diff --git a/cmd/server/app/cmd/commands/configtemplete.go b/cmd/server/app/cmd/commands/configtemplete.go index 20085b5679f1f825728e941ca1d615454d6aca69..d8686d3c58042d2864dfc476c7b926424fa95a55 100644 --- a/cmd/server/app/cmd/commands/configtemplete.go +++ b/cmd/server/app/cmd/commands/configtemplete.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package commands import ( diff --git a/cmd/server/app/cmd/commands/docs.go b/cmd/server/app/cmd/commands/docs.go index 3cc554955b5b54a50b7d6b3735789be45ba5f7f6..34eecb951fa6bf23d9b6f7ca3d8916bb84f77599 100644 --- a/cmd/server/app/cmd/commands/docs.go +++ b/cmd/server/app/cmd/commands/docs.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package commands import ( diff --git a/cmd/server/app/cmd/commands/root.go b/cmd/server/app/cmd/commands/root.go index 91c4ab34e351febf316678ab688dd22c479f69cc..cf913f190897fbf9287358211ad01efd98885ddb 100644 --- a/cmd/server/app/cmd/commands/root.go +++ b/cmd/server/app/cmd/commands/root.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package commands import ( diff --git a/cmd/server/app/cmd/commands/server.go b/cmd/server/app/cmd/commands/server.go index 8a9ddcb9158c62e8588175d9c499625a9d7ca0da..facd2705356afad8240e3e85cba3ab92c8b96902 100644 --- a/cmd/server/app/cmd/commands/server.go +++ b/cmd/server/app/cmd/commands/server.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package commands import ( diff --git a/cmd/server/app/cmd/commands/version.go b/cmd/server/app/cmd/commands/version.go index 646d51ff23ff62de05dab6fbb053923631327071..f89f8564328572448f32c54bfd9afb68cf9b86eb 100644 --- a/cmd/server/app/cmd/commands/version.go +++ b/cmd/server/app/cmd/commands/version.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package commands import ( diff --git a/cmd/server/app/cmd/options/options.go b/cmd/server/app/cmd/options/options.go index 7f1a6082b58bdcbef379a0e8f3cf99f965218d93..c5e51aa57c72f0b38c2880d814f7ea75ee6de36c 100644 --- a/cmd/server/app/cmd/options/options.go +++ b/cmd/server/app/cmd/options/options.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: yangzhao1 - * Date: 2022-04-06 13:27:45 - * LastEditTime: 2023-09-04 16:16:36 - * Description: provide agent log manager of pilotgo - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package options import ( diff --git a/cmd/server/app/config/config.go b/cmd/server/app/config/config.go index fe9e2ee8d0b40f19502bb602093f933614145b85..47ae750da2c17dfee0c3e93b273950621f702239 100644 --- a/cmd/server/app/config/config.go +++ b/cmd/server/app/config/config.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: yangzhao1 - * Date: 2022-04-06 13:27:45 - * LastEditTime: 2023-09-04 16:16:36 - * Description: provide agent log manager of pilotgo - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package config import "gitee.com/openeuler/PilotGo/cmd/server/app/cmd/options" diff --git a/cmd/server/app/network/controller/agentcontroller/agent.go b/cmd/server/app/network/controller/agentcontroller/agent.go index f549a62aca9c974004aa5cad98cc6ca85fa3f42b..b68a1c42c3bd877a616f729edf2d12e48480340e 100644 --- a/cmd/server/app/network/controller/agentcontroller/agent.go +++ b/cmd/server/app/network/controller/agentcontroller/agent.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-01-24 15:08:08 - * LastEditTime: 2023-09-08 16:45:13 - * Description: Get the basic information of the machine - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/config.go b/cmd/server/app/network/controller/agentcontroller/config.go index 3e6bda847ef3618c214b74b5e805928fcf16b846..2c60bdc108bb4fcc6a59714bcb162a65acc7cf81 100644 --- a/cmd/server/app/network/controller/agentcontroller/config.go +++ b/cmd/server/app/network/controller/agentcontroller/config.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/cpu.go b/cmd/server/app/network/controller/agentcontroller/cpu.go index 87bcd90d41367084eef1d23c5b6a4f3a77d1a473..ca1e66959ccdf058dae18cc2a79ae3b16cadab1a 100644 --- a/cmd/server/app/network/controller/agentcontroller/cpu.go +++ b/cmd/server/app/network/controller/agentcontroller/cpu.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-16 15:13:25 - * LastEditTime: 2022-04-13 15:51:43 - * Description: provide agent cpu manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/cron.go b/cmd/server/app/network/controller/agentcontroller/cron.go index 69acd9d70c0ef4448eefd5eb32854941428a4f13..c8e42dc33b3d2a247ff797e45c52514abbaa0a41 100644 --- a/cmd/server/app/network/controller/agentcontroller/cron.go +++ b/cmd/server/app/network/controller/agentcontroller/cron.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-05-23 10:25:52 - * LastEditTime: 2022-05-23 15:16:10 - * Description: os scheduled task - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/disk.go b/cmd/server/app/network/controller/agentcontroller/disk.go index 2d3d24976e42572432a238013ff85bee3284fe19..6163d9c46d9744cc7ee1ba919ded3beea823499e 100644 --- a/cmd/server/app/network/controller/agentcontroller/disk.go +++ b/cmd/server/app/network/controller/agentcontroller/disk.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-16 15:13:25 - * LastEditTime: 2022-02-24 15:51:43 - * Description: provide agent disk manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/file.go b/cmd/server/app/network/controller/agentcontroller/file.go index 3fb9306c0ea48bce7ddf6088b0d6441b85e5c7e3..ecb7ac7e5dc0cdeecfad9a04f6716578dd8e49d5 100644 --- a/cmd/server/app/network/controller/agentcontroller/file.go +++ b/cmd/server/app/network/controller/agentcontroller/file.go @@ -1,18 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-05-26 10:25:52 - * LastEditTime: 2023-07-11 19:25:23 - * Description: agent config file handler - ******************************************************************************/ - +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/firewall.go b/cmd/server/app/network/controller/agentcontroller/firewall.go index da1f4023b07d05e497eb76472ee07142b4c6c273..d11b5fdd4c99de36ec97d385d39cc979dd9b693c 100644 --- a/cmd/server/app/network/controller/agentcontroller/firewall.go +++ b/cmd/server/app/network/controller/agentcontroller/firewall.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2022-04-13 01:51:51 - * Description: provide agent firewall manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/memory.go b/cmd/server/app/network/controller/agentcontroller/memory.go index 64ef3f42620262573bb495ad22b012307fc3a470..9931e8b0d51042a98a759e948be494d2e9d79559 100644 --- a/cmd/server/app/network/controller/agentcontroller/memory.go +++ b/cmd/server/app/network/controller/agentcontroller/memory.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2022-04-13 01:51:51 - * Description: provide agent memory manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/network.go b/cmd/server/app/network/controller/agentcontroller/network.go index 2fa401f8d4046a89d96d161523eaf3b789b819f7..cdb336d24f1b982d9cc3bb4780803a862647259e 100644 --- a/cmd/server/app/network/controller/agentcontroller/network.go +++ b/cmd/server/app/network/controller/agentcontroller/network.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2023-02-21 16:01:22 - * Description: provide agent network manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/os.go b/cmd/server/app/network/controller/agentcontroller/os.go index f89e8f82d16f512bfeea4d21b322b1ff08f03fdc..44f2815eeed3ff55dc69cd021245f10b5289ef37 100644 --- a/cmd/server/app/network/controller/agentcontroller/os.go +++ b/cmd/server/app/network/controller/agentcontroller/os.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2022-04-13 01:51:51 - * Description: provide agent rpm manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/rpm.go b/cmd/server/app/network/controller/agentcontroller/rpm.go index e77eac9249da414cad80c65b484b852af1066c16..51563c4e3734f3f586e5bf3de0d6a2374169bcce 100644 --- a/cmd/server/app/network/controller/agentcontroller/rpm.go +++ b/cmd/server/app/network/controller/agentcontroller/rpm.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2022-04-13 01:51:51 - * Description: provide agent rpm manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/script.go b/cmd/server/app/network/controller/agentcontroller/script.go index ed9071316226c2ae59c8e6640cf350e846976d17..13f406492b4834409b160258ef637d756b37c4ed 100644 --- a/cmd/server/app/network/controller/agentcontroller/script.go +++ b/cmd/server/app/network/controller/agentcontroller/script.go @@ -1,99 +1,92 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2022-04-20 15:51:51 - * Description: provide agent run script functions. - ******************************************************************************/ -package agentcontroller - -import ( - "regexp" - - "gitee.com/openeuler/PilotGo/cmd/server/app/agentmanager" - "gitee.com/openeuler/PilotGo/sdk/logger" - "gitee.com/openeuler/PilotGo/sdk/response" - "github.com/gin-gonic/gin" -) - -func RunCmd(c *gin.Context) { - logger.Debug("process get agent request") - // TODO: process agent info - uuid := c.Query("uuid") - cmd := c.Query("cmd") - - agent := agentmanager.GetAgent(uuid) - if agent != nil { - data, err := agent.RunCommand(cmd) - if err != nil { - logger.Error("run command error, agent:%s, cmd:%s", uuid, cmd) - response.Fail(c, gin.H{"status": false}, err.Error()) - } - logger.Info("run command on agent result:%v", data) - response.Success(c, nil, "run command success") - return - } - - logger.Info("unknown agent:%s", uuid) - response.Fail(c, gin.H{"status": false}, "unknown agent") -} - -func RunScriptWithBooleanCheck(c *gin.Context) { - logger.Debug("process get agent script request") - uuid := c.Query("uuid") - cmd := c.Query("cmd") - - // 调用检测高危命令 - if containsDangerousCommand(cmd) { - logger.Warn("Detected dangerous command") - response.Fail(c, gin.H{"status": false}, "Dangerous command detected in script.") - return - } - - agent := agentmanager.GetAgent(uuid) - if agent != nil { - data, err := agent.RunCommand(cmd) - if err != nil { - logger.Error("run script error, agent:%s, cmd:%s", uuid, cmd) - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - logger.Info("run script on agent result:%v", data) - response.Success(c, nil, "run script success") - return - } - - logger.Info("unknown agent:%s", uuid) - response.Fail(c, gin.H{"status": false}, "unknown agent") -} - -func containsDangerousCommand(content string) bool { - for _, pattern := range dangerousCommandsList { - matched, err := regexp.MatchString(pattern, content) - if err != nil { - logger.Error("Error matching pattern %s: %v\n", pattern, err) - // TODO - continue - } - if matched { - return true - } - } - return false -} - -var dangerousCommandsList = []string{ - `.*rm\s+-[r,f,rf].*`, - `.*lvremove\s+-f.*`, - `.*poweroff.*`, - `.*shutdown\s+-[f,F,h,k,n,r,t,C].*`, - `.*pvremove\s+-f.*`, - `.*vgremove\s+-f.*`, -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package agentcontroller + +import ( + "regexp" + + "gitee.com/openeuler/PilotGo/cmd/server/app/agentmanager" + "gitee.com/openeuler/PilotGo/sdk/logger" + "gitee.com/openeuler/PilotGo/sdk/response" + "github.com/gin-gonic/gin" +) + +func RunCmd(c *gin.Context) { + logger.Debug("process get agent request") + // TODO: process agent info + uuid := c.Query("uuid") + cmd := c.Query("cmd") + + agent := agentmanager.GetAgent(uuid) + if agent != nil { + data, err := agent.RunCommand(cmd) + if err != nil { + logger.Error("run command error, agent:%s, cmd:%s", uuid, cmd) + response.Fail(c, gin.H{"status": false}, err.Error()) + } + logger.Info("run command on agent result:%v", data) + response.Success(c, nil, "run command success") + return + } + + logger.Info("unknown agent:%s", uuid) + response.Fail(c, gin.H{"status": false}, "unknown agent") +} + +func RunScriptWithBooleanCheck(c *gin.Context) { + logger.Debug("process get agent script request") + uuid := c.Query("uuid") + cmd := c.Query("cmd") + + // 调用检测高危命令 + if containsDangerousCommand(cmd) { + logger.Warn("Detected dangerous command") + response.Fail(c, gin.H{"status": false}, "Dangerous command detected in script.") + return + } + + agent := agentmanager.GetAgent(uuid) + if agent != nil { + data, err := agent.RunCommand(cmd) + if err != nil { + logger.Error("run script error, agent:%s, cmd:%s", uuid, cmd) + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + logger.Info("run script on agent result:%v", data) + response.Success(c, nil, "run script success") + return + } + + logger.Info("unknown agent:%s", uuid) + response.Fail(c, gin.H{"status": false}, "unknown agent") +} + +func containsDangerousCommand(content string) bool { + for _, pattern := range dangerousCommandsList { + matched, err := regexp.MatchString(pattern, content) + if err != nil { + logger.Error("Error matching pattern %s: %v\n", pattern, err) + // TODO + continue + } + if matched { + return true + } + } + return false +} + +var dangerousCommandsList = []string{ + `.*rm\s+-[r,f,rf].*`, + `.*lvremove\s+-f.*`, + `.*poweroff.*`, + `.*shutdown\s+-[f,F,h,k,n,r,t,C].*`, + `.*pvremove\s+-f.*`, + `.*vgremove\s+-f.*`, +} diff --git a/cmd/server/app/network/controller/agentcontroller/service.go b/cmd/server/app/network/controller/agentcontroller/service.go index b93d742cc12defd3f169dbb0f63f14992c8c455f..e0eb2df4f2034de5da5503d7f71292a6be63ffaa 100644 --- a/cmd/server/app/network/controller/agentcontroller/service.go +++ b/cmd/server/app/network/controller/agentcontroller/service.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-16 09:28:46 - * LastEditTime: 2022-04-11 17:07:55 - * Description: provide agent service manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/sysctl.go b/cmd/server/app/network/controller/agentcontroller/sysctl.go index b4d077fba3e3c6d4ffebfb8e5162f3041ed1c3e0..45fe4c924de02a8ace2b4e2d5381d7ff312edf0a 100644 --- a/cmd/server/app/network/controller/agentcontroller/sysctl.go +++ b/cmd/server/app/network/controller/agentcontroller/sysctl.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-16 09:28:46 - * LastEditTime: 2022-03-25 02:00:34 - * Description: provide Kernel configuration. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/timecompare.go b/cmd/server/app/network/controller/agentcontroller/timecompare.go index 9d2628c2415930cd9d14258cfb208f5d6a4b9437..3700aadaca39de100d3207a60eeaf7ed0109bd89 100644 --- a/cmd/server/app/network/controller/agentcontroller/timecompare.go +++ b/cmd/server/app/network/controller/agentcontroller/timecompare.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 +*/ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/agentcontroller/user.go b/cmd/server/app/network/controller/agentcontroller/user.go index b568729622327292fd66b2bf1f2da400f3d5554a..91bee7e46faa56de7b12a212b77c56a4c2e7c92c 100644 --- a/cmd/server/app/network/controller/agentcontroller/user.go +++ b/cmd/server/app/network/controller/agentcontroller/user.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-17 02:43:29 - * LastEditTime: 2022-02-24 14:32:25 - * Description: provide agent user manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package agentcontroller import ( diff --git a/cmd/server/app/network/controller/auditloghandler.go b/cmd/server/app/network/controller/auditloghandler.go index 58491476d70f3d826ee8e767ac30c14c75157592..c0e5887e79a0bb77ec80453edddd49e5a8aa72e1 100644 --- a/cmd/server/app/network/controller/auditloghandler.go +++ b/cmd/server/app/network/controller/auditloghandler.go @@ -1,84 +1,77 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-23 17:44:00 - * LastEditTime: 2022-03-24 00:18:14 - * Description: provide agent log manager functions. - ******************************************************************************/ -package controller - -import ( - "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/common" - "gitee.com/openeuler/PilotGo/sdk/response" - "github.com/gin-gonic/gin" -) - -// 查询所有审计日志 -func AuditLogAllHandler(c *gin.Context) { - query := &common.PaginationQ{} - err := c.ShouldBindQuery(query) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - - num := query.Size * (query.CurrentPageNum - 1) - total, data, err := auditlog.GetAuditLogPaged(num, query.Size) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - common.JsonPagination(c, data, total, query) -} - -// 根据模块名字查询日志 -func ModuleLogHandler(c *gin.Context) { - var moduleName string - if c.Bind(&moduleName) != nil { - response.Fail(c, nil, "parameter error") - return - } - loglist, err := auditlog.GetByModule(moduleName) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - response.Success(c, loglist, "模块审计日志查询成功!") -} - -// 查询所有父日志为空的日志 -func LogAllHandler(c *gin.Context) { - query := &common.PaginationQ{} - err := c.ShouldBindQuery(query) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - - num := query.Size * (query.CurrentPageNum - 1) - total, data, err := auditlog.GetParentLog(num, query.Size) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - common.JsonPagination(c, data, total, query) -} - -// 查询其子日志 -func GetAuditLogByIdHandler(c *gin.Context) { - parent_uuid := c.Query("uuid") - data, err := auditlog.GetAuditLogById(parent_uuid) - if err != nil { - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, data, "审计子日志查询成功!") -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package controller + +import ( + "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/common" + "gitee.com/openeuler/PilotGo/sdk/response" + "github.com/gin-gonic/gin" +) + +// 查询所有审计日志 +func AuditLogAllHandler(c *gin.Context) { + query := &common.PaginationQ{} + err := c.ShouldBindQuery(query) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + + num := query.Size * (query.CurrentPageNum - 1) + total, data, err := auditlog.GetAuditLogPaged(num, query.Size) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + common.JsonPagination(c, data, total, query) +} + +// 根据模块名字查询日志 +func ModuleLogHandler(c *gin.Context) { + var moduleName string + if c.Bind(&moduleName) != nil { + response.Fail(c, nil, "parameter error") + return + } + loglist, err := auditlog.GetByModule(moduleName) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + response.Success(c, loglist, "模块审计日志查询成功!") +} + +// 查询所有父日志为空的日志 +func LogAllHandler(c *gin.Context) { + query := &common.PaginationQ{} + err := c.ShouldBindQuery(query) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + + num := query.Size * (query.CurrentPageNum - 1) + total, data, err := auditlog.GetParentLog(num, query.Size) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + common.JsonPagination(c, data, total, query) +} + +// 查询其子日志 +func GetAuditLogByIdHandler(c *gin.Context) { + parent_uuid := c.Query("uuid") + data, err := auditlog.GetAuditLogById(parent_uuid) + if err != nil { + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, data, "审计子日志查询成功!") +} diff --git a/cmd/server/app/network/controller/batch.go b/cmd/server/app/network/controller/batch.go index 0ba8f353188347f3cc462aa288bc1e3b4a848667..6391e7fcd8df32d13aa9690e731f75cd85c5fb18 100644 --- a/cmd/server/app/network/controller/batch.go +++ b/cmd/server/app/network/controller/batch.go @@ -1,177 +1,184 @@ -package controller - -import ( - "strconv" - - "gitee.com/openeuler/PilotGo/cmd/server/app/network/jwt" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/batch" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/common" - "gitee.com/openeuler/PilotGo/pkg/utils/message/net" - "gitee.com/openeuler/PilotGo/sdk/response" - "github.com/gin-gonic/gin" - "github.com/google/uuid" -) - -// 添加批次 -func CreateBatchHandler(c *gin.Context) { - params := &batch.CreateBatchParam{} - if err := c.Bind(params); err != nil { - response.Fail(c, nil, net.GetValidMsg(err, params)) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleBatch, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "创建批次", - } - auditlog.Add(log) - params.Manager = u.Email - - if err := batch.CreateBatch(params); err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "批次入库成功") -} - -// 分页查询所有批次 -func BatchInfoHandler(c *gin.Context) { - p := &common.PaginationQ{} - err := c.ShouldBindQuery(p) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - - num := p.Size * (p.CurrentPageNum - 1) - total, data, err := batch.GetBatchPaged(num, p.Size) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - common.JsonPagination(c, data, total, p) -} - -// 删除批次 -func DeleteBatchHandler(c *gin.Context) { - batchdel := struct { - BatchID []int `json:"BatchID"` - }{} - if err := c.Bind(&batchdel); err != nil { - response.Fail(c, nil, "parameter error") - return - } - if len(batchdel.BatchID) == 0 { - response.Fail(c, nil, "请输入删除批次ID") - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleBatch, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "删除批次", - } - auditlog.Add(log) - - if err := batch.DeleteBatch(batchdel.BatchID); err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - response.Success(c, nil, "批次删除成功") -} - -// 更改批次 -func UpdateBatchHandler(c *gin.Context) { - batchinfo := struct { - BatchId int `json:"BatchID"` - BatchName string `json:"BatchName"` - Description string `json:"Description"` - }{} - if err := c.Bind(&batchinfo); err != nil { - response.Fail(c, nil, "parameter error") - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleBatch, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "编辑批次", - } - auditlog.Add(log) - - err = batch.UpdateBatch(batchinfo.BatchId, batchinfo.BatchName, batchinfo.Description) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, gin.H{"status": false}, "update batch failed: "+err.Error()) - return - } - response.Success(c, nil, "批次修改成功") -} - -// 查询某一个批次 -func BatchMachineInfoHandler(c *gin.Context) { - p := &common.PaginationQ{} - err := c.ShouldBindQuery(p) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - - Batchid := c.Query("ID") - batchid, err := strconv.Atoi(Batchid) - if err != nil { - response.Fail(c, nil, "批次ID输入格式有误") - return - } - - num := p.Size * (p.CurrentPageNum - 1) - total, data, err := batch.GetBatchMachines(num, p.Size, batchid) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - common.JsonPagination(c, data, total, p) -} - -// 一次性获取素有批次,供下拉列表选择 -func SelectBatchHandler(c *gin.Context) { - batch, err := batch.SelectBatch() - if err != nil { - response.Fail(c, nil, "获取批次信息错误"+err.Error()) - return - } - - if len(batch) == 0 { - response.Fail(c, nil, "未获取到批次信息") - return - } - response.Success(c, gin.H{"data": batch}, "批次信息获取成功") -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package controller + +import ( + "strconv" + + "gitee.com/openeuler/PilotGo/cmd/server/app/network/jwt" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/batch" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/common" + "gitee.com/openeuler/PilotGo/pkg/utils/message/net" + "gitee.com/openeuler/PilotGo/sdk/response" + "github.com/gin-gonic/gin" + "github.com/google/uuid" +) + +// 添加批次 +func CreateBatchHandler(c *gin.Context) { + params := &batch.CreateBatchParam{} + if err := c.Bind(params); err != nil { + response.Fail(c, nil, net.GetValidMsg(err, params)) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleBatch, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "创建批次", + } + auditlog.Add(log) + params.Manager = u.Email + + if err := batch.CreateBatch(params); err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "批次入库成功") +} + +// 分页查询所有批次 +func BatchInfoHandler(c *gin.Context) { + p := &common.PaginationQ{} + err := c.ShouldBindQuery(p) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + + num := p.Size * (p.CurrentPageNum - 1) + total, data, err := batch.GetBatchPaged(num, p.Size) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + common.JsonPagination(c, data, total, p) +} + +// 删除批次 +func DeleteBatchHandler(c *gin.Context) { + batchdel := struct { + BatchID []int `json:"BatchID"` + }{} + if err := c.Bind(&batchdel); err != nil { + response.Fail(c, nil, "parameter error") + return + } + if len(batchdel.BatchID) == 0 { + response.Fail(c, nil, "请输入删除批次ID") + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleBatch, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "删除批次", + } + auditlog.Add(log) + + if err := batch.DeleteBatch(batchdel.BatchID); err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + response.Success(c, nil, "批次删除成功") +} + +// 更改批次 +func UpdateBatchHandler(c *gin.Context) { + batchinfo := struct { + BatchId int `json:"BatchID"` + BatchName string `json:"BatchName"` + Description string `json:"Description"` + }{} + if err := c.Bind(&batchinfo); err != nil { + response.Fail(c, nil, "parameter error") + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleBatch, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "编辑批次", + } + auditlog.Add(log) + + err = batch.UpdateBatch(batchinfo.BatchId, batchinfo.BatchName, batchinfo.Description) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, gin.H{"status": false}, "update batch failed: "+err.Error()) + return + } + response.Success(c, nil, "批次修改成功") +} + +// 查询某一个批次 +func BatchMachineInfoHandler(c *gin.Context) { + p := &common.PaginationQ{} + err := c.ShouldBindQuery(p) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + + Batchid := c.Query("ID") + batchid, err := strconv.Atoi(Batchid) + if err != nil { + response.Fail(c, nil, "批次ID输入格式有误") + return + } + + num := p.Size * (p.CurrentPageNum - 1) + total, data, err := batch.GetBatchMachines(num, p.Size, batchid) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + common.JsonPagination(c, data, total, p) +} + +// 一次性获取素有批次,供下拉列表选择 +func SelectBatchHandler(c *gin.Context) { + batch, err := batch.SelectBatch() + if err != nil { + response.Fail(c, nil, "获取批次信息错误"+err.Error()) + return + } + + if len(batch) == 0 { + response.Fail(c, nil, "未获取到批次信息") + return + } + response.Success(c, gin.H{"data": batch}, "批次信息获取成功") +} diff --git a/cmd/server/app/network/controller/cluster.go b/cmd/server/app/network/controller/cluster.go index b3159900bc21e1767f7c577f9dea2c7c5676e675..46010e57d5ca500bc55667509e3c6e088be8301f 100644 --- a/cmd/server/app/network/controller/cluster.go +++ b/cmd/server/app/network/controller/cluster.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-03-24 00:46:05 - * LastEditTime: 2022-04-29 11:29:44 - * Description: 集群概览 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/config.go b/cmd/server/app/network/controller/config.go index 7ab8cdd949f7b09a98afb1ddbc0646d69b510a13..6ee4862bc8549625186983bf3862dac2b439a230 100644 --- a/cmd/server/app/network/controller/config.go +++ b/cmd/server/app/network/controller/config.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-06-16 10:25:52 - * LastEditTime: 2022-06-16 16:16:10 - * Description: file info handler - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/depart.go b/cmd/server/app/network/controller/depart.go index b58067bc4d944e69517b5927d4da32a5c3901e48..d01fa250795751b3972d55a7f58dbad97b00dbb3 100644 --- a/cmd/server/app/network/controller/depart.go +++ b/cmd/server/app/network/controller/depart.go @@ -1,178 +1,171 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-06-02 10:25:52 - * LastEditTime: 2022-06-08 16:16:10 - * Description: depart info handler - ******************************************************************************/ -package controller - -import ( - "strconv" - - "gitee.com/openeuler/PilotGo/cmd/server/app/network/jwt" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/depart" - "gitee.com/openeuler/PilotGo/pkg/utils/message/net" - "gitee.com/openeuler/PilotGo/sdk/response" - "github.com/gin-gonic/gin" - "github.com/google/uuid" -) - -type NewDepart struct { - DepartID int `json:"DepartID" binding:"required" msg:"部门id不能为空"` - DepartName string `json:"DepartName" binding:"required" msg:"部门名称不能为空"` -} - -// 获取部门下所有机器列表,若想获取根节点部门,传入departid=1 -func MachineListHandler(c *gin.Context) { - DepartId := c.Query("DepartId") - DepId, err := strconv.Atoi(DepartId) - if err != nil { - response.Fail(c, nil, "参数错误") - return - } - - machinelist, err := depart.MachineList(DepId) - if err != nil { - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, machinelist, "部门下所属机器获取成功") -} - -// 根据部门id在部门树中查询部门节点 -func DepartHandler(c *gin.Context) { - departID := c.Query("DepartID") - tmp, err := strconv.Atoi(departID) - if err != nil { - response.Fail(c, nil, "部门ID有误") - return - } - //构造部门树 - departRoot, err := depart.DepartInfo() - if err != nil { - response.Fail(c, nil, err.Error()) - return - } - //查询节点 - node, err := depart.Dept(tmp, departRoot) - if err != nil { - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, node, "获取当前部门及子部门信息") -} - -// 生成部门树 -func DepartInfoHandler(c *gin.Context) { - departRoot, err := depart.DepartInfo() - if err != nil { - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, departRoot, "获取全部的部门信息") -} - -// 添加部门节点 -func AddDepartHandler(c *gin.Context) { - newDepart := depart.AddDepartNode{} - if err := c.Bind(&newDepart); err != nil { - response.Fail(c, nil, net.GetValidMsg(err, &newDepart)) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleDepart, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "添加部门信息", - } - auditlog.Add(log) - - err = depart.AddDepart(&newDepart) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "部门信息入库成功") -} - -// 删除部门节点 -func DeleteDepartDataHandler(c *gin.Context) { - var DelDept depart.DeleteDeparts - if err := c.Bind(&DelDept); err != nil { - response.Fail(c, nil, "parameter error") - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleDepart, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "删除部门信息", - } - auditlog.Add(log) - - err = depart.DeleteDepart(&DelDept) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "部门删除成功") -} - -// 更改部门节点名字 -func UpdateDepartHandler(c *gin.Context) { - var new NewDepart - if err := c.Bind(&new); err != nil { - response.Fail(c, nil, net.GetValidMsg(err, &new)) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleDepart, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "修改部门信息", - } - auditlog.Add(log) - - err = depart.UpdateDepart(new.DepartID, new.DepartName) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "部门更新成功") -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package controller + +import ( + "strconv" + + "gitee.com/openeuler/PilotGo/cmd/server/app/network/jwt" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/depart" + "gitee.com/openeuler/PilotGo/pkg/utils/message/net" + "gitee.com/openeuler/PilotGo/sdk/response" + "github.com/gin-gonic/gin" + "github.com/google/uuid" +) + +type NewDepart struct { + DepartID int `json:"DepartID" binding:"required" msg:"部门id不能为空"` + DepartName string `json:"DepartName" binding:"required" msg:"部门名称不能为空"` +} + +// 获取部门下所有机器列表,若想获取根节点部门,传入departid=1 +func MachineListHandler(c *gin.Context) { + DepartId := c.Query("DepartId") + DepId, err := strconv.Atoi(DepartId) + if err != nil { + response.Fail(c, nil, "参数错误") + return + } + + machinelist, err := depart.MachineList(DepId) + if err != nil { + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, machinelist, "部门下所属机器获取成功") +} + +// 根据部门id在部门树中查询部门节点 +func DepartHandler(c *gin.Context) { + departID := c.Query("DepartID") + tmp, err := strconv.Atoi(departID) + if err != nil { + response.Fail(c, nil, "部门ID有误") + return + } + //构造部门树 + departRoot, err := depart.DepartInfo() + if err != nil { + response.Fail(c, nil, err.Error()) + return + } + //查询节点 + node, err := depart.Dept(tmp, departRoot) + if err != nil { + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, node, "获取当前部门及子部门信息") +} + +// 生成部门树 +func DepartInfoHandler(c *gin.Context) { + departRoot, err := depart.DepartInfo() + if err != nil { + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, departRoot, "获取全部的部门信息") +} + +// 添加部门节点 +func AddDepartHandler(c *gin.Context) { + newDepart := depart.AddDepartNode{} + if err := c.Bind(&newDepart); err != nil { + response.Fail(c, nil, net.GetValidMsg(err, &newDepart)) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleDepart, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "添加部门信息", + } + auditlog.Add(log) + + err = depart.AddDepart(&newDepart) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "部门信息入库成功") +} + +// 删除部门节点 +func DeleteDepartDataHandler(c *gin.Context) { + var DelDept depart.DeleteDeparts + if err := c.Bind(&DelDept); err != nil { + response.Fail(c, nil, "parameter error") + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleDepart, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "删除部门信息", + } + auditlog.Add(log) + + err = depart.DeleteDepart(&DelDept) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "部门删除成功") +} + +// 更改部门节点名字 +func UpdateDepartHandler(c *gin.Context) { + var new NewDepart + if err := c.Bind(&new); err != nil { + response.Fail(c, nil, net.GetValidMsg(err, &new)) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleDepart, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "修改部门信息", + } + auditlog.Add(log) + + err = depart.UpdateDepart(new.DepartID, new.DepartName) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "部门更新成功") +} diff --git a/cmd/server/app/network/controller/fileservice.go b/cmd/server/app/network/controller/fileservice.go index 014a9a2849f8d91fdc543ef3a8c4c85e7a8edb86..876c7e1ea70bf609ef5128bb2f58c91e42ca44fd 100644 --- a/cmd/server/app/network/controller/fileservice.go +++ b/cmd/server/app/network/controller/fileservice.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/machine.go b/cmd/server/app/network/controller/machine.go index 56cff78841399bb4aaa092e17e7a33feb2c9ba82..2b60922d1490633e9361d4a7baf6284ea303547a 100644 --- a/cmd/server/app/network/controller/machine.go +++ b/cmd/server/app/network/controller/machine.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: wanghao - * Date: 2022-02-18 13:03:16 - * LastEditTime: 2022-06-08 09:58:35 - * Description: provide machine manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/plugin.go b/cmd/server/app/network/controller/plugin.go index c27fe54715357a95e44de9195c496590722da5af..f6b1bb0df38037fa69867a0613d48ca0b4681b3b 100644 --- a/cmd/server/app/network/controller/plugin.go +++ b/cmd/server/app/network/controller/plugin.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/pluginWebsocketProxy.go b/cmd/server/app/network/controller/pluginWebsocketProxy.go index 23919b62cf1ffa718d76ce910073e17d972f7a2d..f50729ac77296c0f237006e59b4fa418b6bc144e 100644 --- a/cmd/server/app/network/controller/pluginWebsocketProxy.go +++ b/cmd/server/app/network/controller/pluginWebsocketProxy.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: Wangjunqi123 + * Date: Fri Oct 25 16:02:57 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/pluginapi/batch.go b/cmd/server/app/network/controller/pluginapi/batch.go index 5b79e0e3213209877da7409745f72744657bb4ca..a1eca8219eaa578cfabcbf2606ad63bc27fa156d 100644 --- a/cmd/server/app/network/controller/pluginapi/batch.go +++ b/cmd/server/app/network/controller/pluginapi/batch.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pluginapi/config.go b/cmd/server/app/network/controller/pluginapi/config.go index 9cf1acea53ea4dc7f25b82ffa948646e8fee8803..5a33af968e4534d2735485a3b51bf63bfbb13455 100644 --- a/cmd/server/app/network/controller/pluginapi/config.go +++ b/cmd/server/app/network/controller/pluginapi/config.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pluginapi/machine.go b/cmd/server/app/network/controller/pluginapi/machine.go index 9c5155762b675682a65210a61d685baf0bd61dec..0d2370fc1beb0cbe36d80837ed62150794ff08f5 100644 --- a/cmd/server/app/network/controller/pluginapi/machine.go +++ b/cmd/server/app/network/controller/pluginapi/machine.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pluginapi/package.go b/cmd/server/app/network/controller/pluginapi/package.go index c1a2ced86a78c283e1fe9ecaece4f3ad1bfd6bd3..d273183ed2a962c0dee3281e3b3d69fbbad2fe94 100644 --- a/cmd/server/app/network/controller/pluginapi/package.go +++ b/cmd/server/app/network/controller/pluginapi/package.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pluginapi/plugin.go b/cmd/server/app/network/controller/pluginapi/plugin.go index a539998c7edff8912c36b08784c8aa2eac53a278..d827dda7afbc8f315da71c807b659d687953acbf 100644 --- a/cmd/server/app/network/controller/pluginapi/plugin.go +++ b/cmd/server/app/network/controller/pluginapi/plugin.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pluginapi/script.go b/cmd/server/app/network/controller/pluginapi/script.go index 39221d43957eb7bdd192e5e621cbf00586af1e67..1431b93eb77069e8ccaba72c7f64d1cc3015699b 100644 --- a/cmd/server/app/network/controller/pluginapi/script.go +++ b/cmd/server/app/network/controller/pluginapi/script.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ // 插件系统对外提供的api package pluginapi diff --git a/cmd/server/app/network/controller/pluginapi/service.go b/cmd/server/app/network/controller/pluginapi/service.go index 5a67bc7dd297b43f845f8c4f645d128ad3a7111a..9634420f924ebd64949e6f0c7de5824ce7a0af72 100644 --- a/cmd/server/app/network/controller/pluginapi/service.go +++ b/cmd/server/app/network/controller/pluginapi/service.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pluginapi/tag.go b/cmd/server/app/network/controller/pluginapi/tag.go index 326ca3fa94453032839f48d7d183bb9e138bacad..efec840e2ce7915f18edb7cca8e7d2d49887bf17 100644 --- a/cmd/server/app/network/controller/pluginapi/tag.go +++ b/cmd/server/app/network/controller/pluginapi/tag.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package pluginapi import ( diff --git a/cmd/server/app/network/controller/pushalarm.go b/cmd/server/app/network/controller/pushalarm.go index 8b70bf0519632162911fd8b11af18dc90cd71a6c..6c623d170a70982537d8b2dddf71b4c883c41e56 100644 --- a/cmd/server/app/network/controller/pushalarm.go +++ b/cmd/server/app/network/controller/pushalarm.go @@ -1,18 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-06-24 10:48:55 - * LastEditTime: 2022-06-24 16:48:55 - * Description: 通过web socket方式推送告警 - ******************************************************************************/ - +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/role.go b/cmd/server/app/network/controller/role.go index 706d5729683f590e38af06cebe30a01434157345..ee9078e057f6de1d4119659f5b551e7d11ff78e5 100644 --- a/cmd/server/app/network/controller/role.go +++ b/cmd/server/app/network/controller/role.go @@ -1,200 +1,193 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-03-07 15:32:38 - * LastEditTime: 2022-04-12 14:10:09 - * Description: 权限控制 - ******************************************************************************/ -package controller - -import ( - "gitee.com/openeuler/PilotGo/cmd/server/app/network/jwt" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/common" - "gitee.com/openeuler/PilotGo/cmd/server/app/service/plugin" - roleservice "gitee.com/openeuler/PilotGo/cmd/server/app/service/role" - "gitee.com/openeuler/PilotGo/sdk/response" - "github.com/gin-gonic/gin" - "github.com/google/uuid" -) - -// 获取所有角色 -func GetRolesHandler(c *gin.Context) { - data, err := roleservice.GetRoles() - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - response.Success(c, data, "角色权限列表") -} - -// 分页获取所有角色 -func GetRolesPagedHandler(c *gin.Context) { - p := &common.PaginationQ{} - err := c.ShouldBindQuery(p) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - - num := p.Size * (p.CurrentPageNum - 1) - total, data, err := roleservice.GetRolePaged(num, p.Size) - if err != nil { - response.Fail(c, gin.H{"status": false}, err.Error()) - return - } - common.JsonPagination(c, data, total, p) -} - -// 添加角色 -func AddRoleHandler(c *gin.Context) { - params := &struct { - Role string `json:"role"` - Description string `json:"description"` - }{} - if err := c.Bind(params); err != nil { - response.Fail(c, nil, "parameter error:"+err.Error()) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleRole, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "添加角色", - } - auditlog.Add(log) - - userRole := &roleservice.Role{ - Name: params.Role, - Description: params.Description, - } - - err = roleservice.AddRole(userRole) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "新增角色成功") -} - -// 删除角色 -func DeleteRoleHandler(c *gin.Context) { - params := &struct { - RoleId int `json:"role"` - }{} - if err := c.Bind(params); err != nil { - response.Fail(c, nil, "parameter error:"+err.Error()) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleRole, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "删除角色", - } - auditlog.Add(log) - - err = roleservice.DeleteRole(params.RoleId) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, "有用户绑定此角色,不可删除") - return - } - response.Success(c, nil, "角色删除成功") -} - -// 更改角色 -func UpdateRoleInfoHandler(c *gin.Context) { - params := &struct { - Role string `json:"role"` - Description string `json:"description"` - }{} - if err := c.Bind(params); err != nil { - response.Fail(c, nil, "parameter error:"+err.Error()) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleRole, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "修改角色信息", - } - auditlog.Add(log) - - err = roleservice.UpdateRoleInfo(params.Role, params.Description) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "角色信息修改成功") -} - -// 更改角色权限 -func RolePermissionChangeHandler(c *gin.Context) { - params := &struct { - Buttons []string `json:"buttons"` - Menus []string `json:"menus"` - Role string `json:"role"` - PluginPermissions []plugin.PluginPermission `json:"pluginpermissions"` - }{} - if err := c.Bind(params); err != nil { - response.Fail(c, nil, "parameter error:"+err.Error()) - return - } - - u, err := jwt.ParseUser(c) - if err != nil { - response.Fail(c, nil, "user token error:"+err.Error()) - return - } - log := &auditlog.AuditLog{ - LogUUID: uuid.New().String(), - ParentUUID: "", - Module: auditlog.ModuleRole, - Status: auditlog.StatusOK, - UserID: u.ID, - Action: "修改角色权限", - } - auditlog.Add(log) - - err = roleservice.UpdateRolePermissions(params.Role, params.Buttons, params.Menus, params.PluginPermissions) - if err != nil { - auditlog.UpdateStatus(log, auditlog.StatusFailed) - response.Fail(c, nil, err.Error()) - return - } - response.Success(c, nil, "角色权限变更成功") -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package controller + +import ( + "gitee.com/openeuler/PilotGo/cmd/server/app/network/jwt" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/auditlog" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/common" + "gitee.com/openeuler/PilotGo/cmd/server/app/service/plugin" + roleservice "gitee.com/openeuler/PilotGo/cmd/server/app/service/role" + "gitee.com/openeuler/PilotGo/sdk/response" + "github.com/gin-gonic/gin" + "github.com/google/uuid" +) + +// 获取所有角色 +func GetRolesHandler(c *gin.Context) { + data, err := roleservice.GetRoles() + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + response.Success(c, data, "角色权限列表") +} + +// 分页获取所有角色 +func GetRolesPagedHandler(c *gin.Context) { + p := &common.PaginationQ{} + err := c.ShouldBindQuery(p) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + + num := p.Size * (p.CurrentPageNum - 1) + total, data, err := roleservice.GetRolePaged(num, p.Size) + if err != nil { + response.Fail(c, gin.H{"status": false}, err.Error()) + return + } + common.JsonPagination(c, data, total, p) +} + +// 添加角色 +func AddRoleHandler(c *gin.Context) { + params := &struct { + Role string `json:"role"` + Description string `json:"description"` + }{} + if err := c.Bind(params); err != nil { + response.Fail(c, nil, "parameter error:"+err.Error()) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleRole, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "添加角色", + } + auditlog.Add(log) + + userRole := &roleservice.Role{ + Name: params.Role, + Description: params.Description, + } + + err = roleservice.AddRole(userRole) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "新增角色成功") +} + +// 删除角色 +func DeleteRoleHandler(c *gin.Context) { + params := &struct { + RoleId int `json:"role"` + }{} + if err := c.Bind(params); err != nil { + response.Fail(c, nil, "parameter error:"+err.Error()) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleRole, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "删除角色", + } + auditlog.Add(log) + + err = roleservice.DeleteRole(params.RoleId) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, "有用户绑定此角色,不可删除") + return + } + response.Success(c, nil, "角色删除成功") +} + +// 更改角色 +func UpdateRoleInfoHandler(c *gin.Context) { + params := &struct { + Role string `json:"role"` + Description string `json:"description"` + }{} + if err := c.Bind(params); err != nil { + response.Fail(c, nil, "parameter error:"+err.Error()) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleRole, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "修改角色信息", + } + auditlog.Add(log) + + err = roleservice.UpdateRoleInfo(params.Role, params.Description) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "角色信息修改成功") +} + +// 更改角色权限 +func RolePermissionChangeHandler(c *gin.Context) { + params := &struct { + Buttons []string `json:"buttons"` + Menus []string `json:"menus"` + Role string `json:"role"` + PluginPermissions []plugin.PluginPermission `json:"pluginpermissions"` + }{} + if err := c.Bind(params); err != nil { + response.Fail(c, nil, "parameter error:"+err.Error()) + return + } + + u, err := jwt.ParseUser(c) + if err != nil { + response.Fail(c, nil, "user token error:"+err.Error()) + return + } + log := &auditlog.AuditLog{ + LogUUID: uuid.New().String(), + ParentUUID: "", + Module: auditlog.ModuleRole, + Status: auditlog.StatusOK, + UserID: u.ID, + Action: "修改角色权限", + } + auditlog.Add(log) + + err = roleservice.UpdateRolePermissions(params.Role, params.Buttons, params.Menus, params.PluginPermissions) + if err != nil { + auditlog.UpdateStatus(log, auditlog.StatusFailed) + response.Fail(c, nil, err.Error()) + return + } + response.Success(c, nil, "角色权限变更成功") +} diff --git a/cmd/server/app/network/controller/script.go b/cmd/server/app/network/controller/script.go index b0b8202df7aa87a20cb3dabed3df7b21316178a1..15d1a16c2dc9f9ab6812a7152dd856cf467d2de7 100644 --- a/cmd/server/app/network/controller/script.go +++ b/cmd/server/app/network/controller/script.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/user.go b/cmd/server/app/network/controller/user.go index 48c77fdb3a614799adbc258425b7df0668130154..fe81ae520a59cf315c12255dc7a88b2e35c1b2f9 100644 --- a/cmd/server/app/network/controller/user.go +++ b/cmd/server/app/network/controller/user.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-12-18 02:33:55 - * LastEditTime: 2023-09-04 14:06:46 - * Description: 用户登录、增删改查 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/version.go b/cmd/server/app/network/controller/version.go index 4e94720866b43c9deb41a45199ccb98ab444735f..86b3815ec4c2170ccb34b8bef15f5d1892214307 100644 --- a/cmd/server/app/network/controller/version.go +++ b/cmd/server/app/network/controller/version.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/controller/web_terminal.go b/cmd/server/app/network/controller/web_terminal.go index 6464aaa642d480f52dcd4bb0c2a2673127e5ae75..17af58dfac59ffa630d8ef862292bddfa796845a 100644 --- a/cmd/server/app/network/controller/web_terminal.go +++ b/cmd/server/app/network/controller/web_terminal.go @@ -1,18 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-04-20 16:48:55 - * LastEditTime: 2022-04-20 17:48:55 - * Description: web socket连接控制 - ******************************************************************************/ - +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package controller import ( diff --git a/cmd/server/app/network/httpserver.go b/cmd/server/app/network/httpserver.go index 67c7eedc548e4beb0eba85674b5f5896c4855718..3fb7449a3a934906db7e3058f5039695309377f2 100644 --- a/cmd/server/app/network/httpserver.go +++ b/cmd/server/app/network/httpserver.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-11-18 13:03:16 - * LastEditTime: 2023-09-05 11:08:13 - * Description: Interface routing forwarding - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package network import ( diff --git a/cmd/server/app/network/jwt/jwt.go b/cmd/server/app/network/jwt/jwt.go index 7310712ae4ae4ccff7d4a8247bb37e854370525f..089ad43b15b09552bfb2d1b3603ffd840a5138dc 100644 --- a/cmd/server/app/network/jwt/jwt.go +++ b/cmd/server/app/network/jwt/jwt.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-11-1 15:08:08 - * LastEditTime: 2023-09-04 16:52:24 - * Description: jwt是一个基于token的轻量级认证方式 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package jwt import ( diff --git a/cmd/server/app/network/middleware/auth.go b/cmd/server/app/network/middleware/auth.go index f5a9e6becd917d7a1b6c1ba7641da554edcd1153..326a97d0b655d1fda1f814aef85b23b799b71b86 100644 --- a/cmd/server/app/network/middleware/auth.go +++ b/cmd/server/app/network/middleware/auth.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package middleware import ( diff --git a/cmd/server/app/network/middleware/logger.go b/cmd/server/app/network/middleware/logger.go index df8f9242aef56c9594814f38e3bb14dc23b4857e..19426b8a457821cf0acb0ecf948dad2009abc915 100644 --- a/cmd/server/app/network/middleware/logger.go +++ b/cmd/server/app/network/middleware/logger.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-07-11 15:25:53 - * LastEditTime: 2022-07-11 10:35:54 - * Description: panic recover - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package middleware import ( diff --git a/cmd/server/app/network/session.go b/cmd/server/app/network/session.go index 82b2cefe6c91e873ac8be93258821e703445f486..ef0261686769edd7f3184d65d300f989022d0660 100644 --- a/cmd/server/app/network/session.go +++ b/cmd/server/app/network/session.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package network import ( diff --git a/cmd/server/app/network/socketserver.go b/cmd/server/app/network/socketserver.go index 25d7718b4239eb8c88d253a1e90a10ac279bd52c..0d0eb563fde5457f44d7dfbcbc2492464889bc59 100644 --- a/cmd/server/app/network/socketserver.go +++ b/cmd/server/app/network/socketserver.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-18 02:39:36 - * LastEditTime: 2022-03-04 02:25:56 - * Description: provide agent log manager functions. - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package network import ( diff --git a/cmd/server/app/network/websocket/client.go b/cmd/server/app/network/websocket/client.go index 4413b6966b988790edb22c3f7ef2b867513227b7..e6ef424bf6cab41b35fc5954f69311a0b25129fe 100644 --- a/cmd/server/app/network/websocket/client.go +++ b/cmd/server/app/network/websocket/client.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package websocket import ( diff --git a/cmd/server/app/network/websocket/client_manager.go b/cmd/server/app/network/websocket/client_manager.go index 4af298efeafe8a852b9d8e4ce075ce7617e61777..73391c8ad6fbb1175f4a2267c5deb3bf50cf7501 100644 --- a/cmd/server/app/network/websocket/client_manager.go +++ b/cmd/server/app/network/websocket/client_manager.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package websocket import ( diff --git a/cmd/server/app/network/websocket/sshclient.go b/cmd/server/app/network/websocket/sshclient.go index 88498689b1f2ac8a6b5db7e5eca9eaba71f2a533..3b0c873e1f8df55f5ec7bfa632f8ad6e9174dc8d 100644 --- a/cmd/server/app/network/websocket/sshclient.go +++ b/cmd/server/app/network/websocket/sshclient.go @@ -1,18 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-04-20 16:48:55 - * LastEditTime: 2022-12-8 14:48:55 - * Description: 解析ssh 客户端连接信息 - ******************************************************************************/ - +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package websocket import ( diff --git a/cmd/server/app/network/websocket/webterminal.go b/cmd/server/app/network/websocket/webterminal.go index bf598c6436b87b8f3213c30303cbb469e17dc096..89f7d177177027d630f0e73c81dabd93021d4c3f 100644 --- a/cmd/server/app/network/websocket/webterminal.go +++ b/cmd/server/app/network/websocket/webterminal.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-04-20 16:48:55 - * LastEditTime: 2022-04-20 17:48:55 - * Description: web socket连接结构体 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package websocket import ( diff --git a/cmd/server/app/resource/resource.go b/cmd/server/app/resource/resource.go index db0ffa36cbe02ff5a36e307447bb09d04b9549e9..e47e5bf70550b439afb2b46308d44599cba7dce8 100644 --- a/cmd/server/app/resource/resource.go +++ b/cmd/server/app/resource/resource.go @@ -1,20 +1,14 @@ //go:build !production // +build !production -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-07-12 13:03:16 - * LastEditTime: 2023-09-01 17:04:59 - * Description: static router - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ + package resource import ( diff --git a/cmd/server/app/resource/resource_prod.go b/cmd/server/app/resource/resource_prod.go index 80b9e5e7b1cb9ffbbade8227b1efd1449947ba86..114221c01fe93623a62da84082ff411ec565a3c4 100644 --- a/cmd/server/app/resource/resource_prod.go +++ b/cmd/server/app/resource/resource_prod.go @@ -1,20 +1,14 @@ //go:build production // +build production -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-07-12 13:03:16 - * LastEditTime: 2023-09-01 17:04:59 - * Description: static router - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ + package resource import ( diff --git a/cmd/server/app/service/auditlog/auditlog.go b/cmd/server/app/service/auditlog/auditlog.go index 533b7086245945f28805d1f395b1ed52f955971b..f2c8980fbe8fef9dfbdf64de68f5b5da1e065f0c 100644 --- a/cmd/server/app/service/auditlog/auditlog.go +++ b/cmd/server/app/service/auditlog/auditlog.go @@ -1,84 +1,91 @@ -package auditlog - -import ( - "fmt" - "net/http" - "strconv" - - "gitee.com/openeuler/PilotGo/cmd/server/app/service/internal/dao" -) - -// 日志执行操作状态 -const ( - StatusOK = "OK" - StatusFailed = "failed" -) - -// 日志记录归属模块 -const ( - ModuleUser = "user" // 登录 注销(父日志没有创建者和部门信息) 添加 删除 修改密码 重置密码 修改用户信息 - ModuleRole = "role" // 角色权限 编辑角色 删除角色 添加角色 - ModulePlugin = "plugin" // null - ModuleBatch = "batch" // 添加批次 删除批次 编辑批次 - ModuleMachine = "machine" // null - ModuleDepart = "depart" - //LogTypeRPM = "软件包安装/卸载" // rpm安装 rpm卸载 - //LogTypeService = "运行服务" // null - //LogTypeSysctl = "配置内核参数" // null - //LogTypeBroadcast = "配置文件下发" // 配置文件下发 -) - -type AuditLog = dao.AuditLog - -// 单机操作成功状态:是否成功,机器数量,成功率 -const ( - ActionOK = "1,1,1.00" - ActionFalse = "0,1,0.00" -) - -// 计算批量机器操作的状态:成功数,总数目,比率 -func BatchActionStatus(StatusCodes []string) (status string) { - var StatusOKCounts int - for _, success := range StatusCodes { - if success == strconv.Itoa(http.StatusOK) { - StatusOKCounts++ - } - } - num, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(StatusOKCounts)/float64(len(StatusCodes))), 64) - rate := strconv.FormatFloat(num, 'f', 2, 64) - status = strconv.Itoa(StatusOKCounts) + "," + strconv.Itoa(len(StatusCodes)) + "," + rate - return -} - -func Add(log *dao.AuditLog) error { - return log.Record() -} - -// 修改日志的操作状态 -func UpdateStatus(log *dao.AuditLog, status string) error { - return log.UpdateStatus(status) -} - -// 添加message信息 -func UpdateMessage(log *dao.AuditLog, message string) error { - return log.UpdateMessage(message) -} - -// 分页查询 -func GetAuditLogPaged(offset, size int) (int64, []AuditLog, error) { - return dao.GetAuditLogPaged(offset, size) -} - -// 查询子日志 -func GetAuditLogById(logUUId string) ([]dao.AuditLog, error) { - return dao.GetAuditLogById(logUUId) -} - -// 查询父日志为空的记录 -func GetParentLog(offset, size int) (int64, []AuditLog, error) { - return dao.GetParentLog(offset, size) -} - -func GetByModule(name string) ([]dao.AuditLog, error) { - return dao.GetAuditLogByModule(name) -} +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ +package auditlog + +import ( + "fmt" + "net/http" + "strconv" + + "gitee.com/openeuler/PilotGo/cmd/server/app/service/internal/dao" +) + +// 日志执行操作状态 +const ( + StatusOK = "OK" + StatusFailed = "failed" +) + +// 日志记录归属模块 +const ( + ModuleUser = "user" // 登录 注销(父日志没有创建者和部门信息) 添加 删除 修改密码 重置密码 修改用户信息 + ModuleRole = "role" // 角色权限 编辑角色 删除角色 添加角色 + ModulePlugin = "plugin" // null + ModuleBatch = "batch" // 添加批次 删除批次 编辑批次 + ModuleMachine = "machine" // null + ModuleDepart = "depart" + //LogTypeRPM = "软件包安装/卸载" // rpm安装 rpm卸载 + //LogTypeService = "运行服务" // null + //LogTypeSysctl = "配置内核参数" // null + //LogTypeBroadcast = "配置文件下发" // 配置文件下发 +) + +type AuditLog = dao.AuditLog + +// 单机操作成功状态:是否成功,机器数量,成功率 +const ( + ActionOK = "1,1,1.00" + ActionFalse = "0,1,0.00" +) + +// 计算批量机器操作的状态:成功数,总数目,比率 +func BatchActionStatus(StatusCodes []string) (status string) { + var StatusOKCounts int + for _, success := range StatusCodes { + if success == strconv.Itoa(http.StatusOK) { + StatusOKCounts++ + } + } + num, _ := strconv.ParseFloat(fmt.Sprintf("%.2f", float64(StatusOKCounts)/float64(len(StatusCodes))), 64) + rate := strconv.FormatFloat(num, 'f', 2, 64) + status = strconv.Itoa(StatusOKCounts) + "," + strconv.Itoa(len(StatusCodes)) + "," + rate + return +} + +func Add(log *dao.AuditLog) error { + return log.Record() +} + +// 修改日志的操作状态 +func UpdateStatus(log *dao.AuditLog, status string) error { + return log.UpdateStatus(status) +} + +// 添加message信息 +func UpdateMessage(log *dao.AuditLog, message string) error { + return log.UpdateMessage(message) +} + +// 分页查询 +func GetAuditLogPaged(offset, size int) (int64, []AuditLog, error) { + return dao.GetAuditLogPaged(offset, size) +} + +// 查询子日志 +func GetAuditLogById(logUUId string) ([]dao.AuditLog, error) { + return dao.GetAuditLogById(logUUId) +} + +// 查询父日志为空的记录 +func GetParentLog(offset, size int) (int64, []AuditLog, error) { + return dao.GetParentLog(offset, size) +} + +func GetByModule(name string) ([]dao.AuditLog, error) { + return dao.GetAuditLogByModule(name) +} diff --git a/cmd/server/app/service/auth/casbin.go b/cmd/server/app/service/auth/casbin.go index 50521c102a188b8b422142ca47a40d09f4681230..0b696f07720e95d2b30c74f163090aff9fd15062 100644 --- a/cmd/server/app/service/auth/casbin.go +++ b/cmd/server/app/service/auth/casbin.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-07-04 09:08:08 - * LastEditTime: 2023-09-04 11:12:43 - * Description: casbin服务 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package auth import ( diff --git a/cmd/server/app/service/auth/casbin_test.go b/cmd/server/app/service/auth/casbin_test.go index 8d445008f3aee3703e3c273152e1c08aa03da509..25ccf481189d86fd2d37dd243ddc8c407eeb4f4c 100644 --- a/cmd/server/app/service/auth/casbin_test.go +++ b/cmd/server/app/service/auth/casbin_test.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-07-04 09:08:08 - * LastEditTime: 2023-09-01 16:22:14 - * Description: casbin服务 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package auth import ( diff --git a/cmd/server/app/service/batch/batch.go b/cmd/server/app/service/batch/batch.go index bd623f2f157462c4bf3d6bb69d12ccc75cf1ebf5..99f3a79babfef8971ce083393fe47dcc747426b3 100644 --- a/cmd/server/app/service/batch/batch.go +++ b/cmd/server/app/service/batch/batch.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-05-18 09:08:08 - * LastEditTime: 2023-09-15 14:58:17 - * Description: 批次管理业务逻辑 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package batch import ( diff --git a/cmd/server/app/service/cluster/cluster.go b/cmd/server/app/service/cluster/cluster.go index 6e81ea8133d30dc7b77379897faddd5e521ca842..5bf9d884c279daaeb98ed068d3f211c8f93a96ae 100644 --- a/cmd/server/app/service/cluster/cluster.go +++ b/cmd/server/app/service/cluster/cluster.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-04-29 09:08:08 - * LastEditTime: 2022-04-29 09:25:41 - * Description: 集群概览业务逻辑 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package cluster import ( diff --git a/cmd/server/app/service/common/common.go b/cmd/server/app/service/common/common.go index 041494173530fdc4c36229a6af08dd742d94c41f..2855063282700de20925763bd9618dc026c6956c 100644 --- a/cmd/server/app/service/common/common.go +++ b/cmd/server/app/service/common/common.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-02-23 17:44:00 - * LastEditTime: 2022-04-22 14:18:14 - * Description: 公共函数 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package common import ( diff --git a/cmd/server/app/service/configfile/configfile.go b/cmd/server/app/service/configfile/configfile.go index 9f4a4e5f00c7a1250ecd84e450217321dfc66bd8..b78dec553854aa31a552f39b766327c2698e9b6f 100644 --- a/cmd/server/app/service/configfile/configfile.go +++ b/cmd/server/app/service/configfile/configfile.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package configfile import "gitee.com/openeuler/PilotGo/cmd/server/app/service/internal/dao" diff --git a/cmd/server/app/service/configmanage/configmanage.go b/cmd/server/app/service/configmanage/configmanage.go index 6963a43d04730155bc347197b35ec3440952ed9b..580035e5bcb0f3ae38b0df345262b50d11c31bb9 100644 --- a/cmd/server/app/service/configmanage/configmanage.go +++ b/cmd/server/app/service/configmanage/configmanage.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-05-26 10:25:52 - * LastEditTime: 2022-06-02 10:16:10 - * Description: agent config file service - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package configmanage import ( diff --git a/cmd/server/app/service/configmanage/internal/hosts.go b/cmd/server/app/service/configmanage/internal/hosts.go index 34f313a3706a2d8c6e38289ca61f1fc3251e09ce..ae334d67b82cef1b21ef90dd88bdafd1c789a7cf 100644 --- a/cmd/server/app/service/configmanage/internal/hosts.go +++ b/cmd/server/app/service/configmanage/internal/hosts.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package internal type HostsConfig struct{} diff --git a/cmd/server/app/service/configmanage/internal/repo.go b/cmd/server/app/service/configmanage/internal/repo.go index ccabe16022692ec747ca4921d76cf07badd742b0..060cbd22bfcbd2b710b5da2b09313a091ff2ef97 100644 --- a/cmd/server/app/service/configmanage/internal/repo.go +++ b/cmd/server/app/service/configmanage/internal/repo.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package internal import "gitee.com/openeuler/PilotGo/pkg/utils/os/common" diff --git a/cmd/server/app/service/configmanage/internal/sshconfig.go b/cmd/server/app/service/configmanage/internal/sshconfig.go index 5bf0569ce8cb32a1272137a64ea617b4314f98da..8a3747a7720c3b5e4a350a9030d917ad33802762 100644 --- a/cmd/server/app/service/configmanage/internal/sshconfig.go +++ b/cmd/server/app/service/configmanage/internal/sshconfig.go @@ -1 +1,8 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package internal diff --git a/cmd/server/app/service/configmanage/internal/sshdconfig.go b/cmd/server/app/service/configmanage/internal/sshdconfig.go index 5bf0569ce8cb32a1272137a64ea617b4314f98da..8a3747a7720c3b5e4a350a9030d917ad33802762 100644 --- a/cmd/server/app/service/configmanage/internal/sshdconfig.go +++ b/cmd/server/app/service/configmanage/internal/sshdconfig.go @@ -1 +1,8 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package internal diff --git a/cmd/server/app/service/configmanage/internal/sysctl.go b/cmd/server/app/service/configmanage/internal/sysctl.go index 348e6516844276b712220d370bef84f74cba642d..27e8e05aa4f4877797131236f26ef92e21a334f4 100644 --- a/cmd/server/app/service/configmanage/internal/sysctl.go +++ b/cmd/server/app/service/configmanage/internal/sysctl.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package internal type SysctlConfig struct{} diff --git a/cmd/server/app/service/cron/cron.go b/cmd/server/app/service/cron/cron.go index cba633a620377ea5263d74a92dc4d98c8a19d299..79ea3f3b45c06f05bb73751d7b7aabaf50f7551f 100644 --- a/cmd/server/app/service/cron/cron.go +++ b/cmd/server/app/service/cron/cron.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-05-23 10:25:52 - * LastEditTime: 2022-05-23 15:16:10 - * Description: os scheduled task - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package cron import ( diff --git a/cmd/server/app/service/depart/depart.go b/cmd/server/app/service/depart/depart.go index f18d4d865c1c29e03c6d80115b4ae7050a5aad82..f752876fb52f8ec14c945fe97aa2503ee9ee016c 100644 --- a/cmd/server/app/service/depart/depart.go +++ b/cmd/server/app/service/depart/depart.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-06-02 10:25:52 - * LastEditTime: 2022-06-02 16:16:10 - * Description: depart info service - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package depart import ( diff --git a/cmd/server/app/service/internal/dao/auditlogdao.go b/cmd/server/app/service/internal/dao/auditlogdao.go index 901466d41fad91e7fac734479cf8b037294ef23e..46fa7c19c3eef1d803f5e549a68d09fa28ba7614 100644 --- a/cmd/server/app/service/internal/dao/auditlogdao.go +++ b/cmd/server/app/service/internal/dao/auditlogdao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-04-28 13:08:08 - * LastEditTime: 2022-04-28 14:25:41 - * Description: agent操作日志相关数据获取 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/batchmanagerdao.go b/cmd/server/app/service/internal/dao/batchmanagerdao.go index a76575f6e04d9851aadd68f033c1b831f424f7b5..e00ffaf0c01e4abffc5791a2c620453aa16fdeda 100644 --- a/cmd/server/app/service/internal/dao/batchmanagerdao.go +++ b/cmd/server/app/service/internal/dao/batchmanagerdao.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/configfiledao.go b/cmd/server/app/service/internal/dao/configfiledao.go index 6785186ccdf987b73e68b9aa058f13e1890b195e..160cee01f0cbb3f42a9a6fc8e45f989a1d1333eb 100644 --- a/cmd/server/app/service/internal/dao/configfiledao.go +++ b/cmd/server/app/service/internal/dao/configfiledao.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/configmanagedao.go b/cmd/server/app/service/internal/dao/configmanagedao.go index 26b56225a098aabbf4430d9f9f6b5a5d83e126bf..5daff49bbd72a46dd38221a7b02820d319c2a99f 100644 --- a/cmd/server/app/service/internal/dao/configmanagedao.go +++ b/cmd/server/app/service/internal/dao/configmanagedao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-05-26 10:25:52 - * LastEditTime: 2022-06-02 10:16:10 - * Description: agent config file dao - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/crondao.go b/cmd/server/app/service/internal/dao/crondao.go index 34d85c7483674a2618c0104ed35be4addc8b674e..6525e5d0911a3e63d81b107b5c26e21a3256db00 100644 --- a/cmd/server/app/service/internal/dao/crondao.go +++ b/cmd/server/app/service/internal/dao/crondao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-05-23 10:25:52 - * LastEditTime: 2023-06-28 15:58:39 - * Description: os scheduled task - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/departdao.go b/cmd/server/app/service/internal/dao/departdao.go index 18efdfc3bb9b5007ce8cd52b9ebadfb6403e47b1..12e6a4d3b49f03d5f7a64bca14ad746e150f564e 100644 --- a/cmd/server/app/service/internal/dao/departdao.go +++ b/cmd/server/app/service/internal/dao/departdao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-04-28 13:08:08 - * LastEditTime: 2023-06-28 16:02:24 - * Description: depart相关数据获取 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/machinemanagerdao.go b/cmd/server/app/service/internal/dao/machinemanagerdao.go index 4e41c10e34e3a56a87de5182543856de109b5ede..b150e08729764a2d5318ddb2b08c15990a2d1e81 100644 --- a/cmd/server/app/service/internal/dao/machinemanagerdao.go +++ b/cmd/server/app/service/internal/dao/machinemanagerdao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: wanghao - * Date: 2022-01-04 12:56:59 - * LastEditTime: 2023-07-11 19:34:18 - * Description: 部门管理数据库相关函数 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/plugin.go b/cmd/server/app/service/internal/dao/plugin.go index c2b71da61482451809ccf343a1327bc0f8556822..70a9a0716f3e347e697761bb7e82dc99586686be 100644 --- a/cmd/server/app/service/internal/dao/plugin.go +++ b/cmd/server/app/service/internal/dao/plugin.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - * http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: guozhengxin - * Date: 2022-05-26 10:25:52 - * LastEditTime: 2023-06-28 15:59:45 - * Description: plugin info record - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import "gitee.com/openeuler/PilotGo/pkg/dbmanager/mysqlmanager" diff --git a/cmd/server/app/service/internal/dao/roledao.go b/cmd/server/app/service/internal/dao/roledao.go index a18491fd7aa4992a8c7ebd36c8d6a514eb17d112..46b3c2fd214cff634f725d50a668de365fb3ccfa 100644 --- a/cmd/server/app/service/internal/dao/roledao.go +++ b/cmd/server/app/service/internal/dao/roledao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-01-24 15:08:08 - * LastEditTime: 2023-09-04 14:03:47 - * Description: 角色模块相关数据获取 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/scriptdao.go b/cmd/server/app/service/internal/dao/scriptdao.go index 80ceee1fbce7195ef8feb80c1daeb79cd36530e6..7df041fa8db294618ed1ffdaaacc01a0ccf5fac3 100644 --- a/cmd/server/app/service/internal/dao/scriptdao.go +++ b/cmd/server/app/service/internal/dao/scriptdao.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/userdao.go b/cmd/server/app/service/internal/dao/userdao.go index b3c239ac78ddaa7cbf574e9cb9728523b9bb333c..5e3b490816bae62c7606582ed60ce0acaf174e17 100644 --- a/cmd/server/app/service/internal/dao/userdao.go +++ b/cmd/server/app/service/internal/dao/userdao.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-01-24 15:08:08 - * LastEditTime: 2023-09-04 14:02:00 - * Description: 用户模块相关数据获取 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/internal/dao/userroledao.go b/cmd/server/app/service/internal/dao/userroledao.go index f1ade192aff4207744129561441e162ca76c8b2b..11f3fb5c95c912edea06b24817113f6dda8646c6 100644 --- a/cmd/server/app/service/internal/dao/userroledao.go +++ b/cmd/server/app/service/internal/dao/userroledao.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package dao import ( diff --git a/cmd/server/app/service/machine/machinemanager.go b/cmd/server/app/service/machine/machinemanager.go index 4d207a1a660c3fe6a8aeeebf7860c88680fb5a36..b7fcba25a8629a0f6a48debf0641126d93ca48c0 100644 --- a/cmd/server/app/service/machine/machinemanager.go +++ b/cmd/server/app/service/machine/machinemanager.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package machine import ( diff --git a/cmd/server/app/service/plugin/event.go b/cmd/server/app/service/plugin/event.go index ca9d0e6917ecd3619c1383ddc3542ac9cc3a7432..d10f550337b702f965ad80db95e30bf92c5875a1 100644 --- a/cmd/server/app/service/plugin/event.go +++ b/cmd/server/app/service/plugin/event.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: zhanghan + * Date: Mon Nov 25 16:52:07 2024 +0800 + */ package plugin import ( diff --git a/cmd/server/app/service/plugin/heartbeat.go b/cmd/server/app/service/plugin/heartbeat.go index a0bffa7c8cc0ddafd2b26855429944e300820477..cb60ff619afb56b9931a68ead94e3e0c9ccf5b78 100644 --- a/cmd/server/app/service/plugin/heartbeat.go +++ b/cmd/server/app/service/plugin/heartbeat.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package plugin import ( diff --git a/cmd/server/app/service/plugin/plugin.go b/cmd/server/app/service/plugin/plugin.go index 3e556666715b451a789e999f7fe42818d0dab677..3f74dd4290ec66524ccfcccf46826b59ee305ea2 100644 --- a/cmd/server/app/service/plugin/plugin.go +++ b/cmd/server/app/service/plugin/plugin.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package plugin import ( diff --git a/cmd/server/app/service/plugin/proxy.go b/cmd/server/app/service/plugin/proxy.go index b0736c3a052cd06b4abff728cd4615c76a3d613e..7b5816e64a1471a13e455928c36053a955b2fa98 100644 --- a/cmd/server/app/service/plugin/proxy.go +++ b/cmd/server/app/service/plugin/proxy.go @@ -1 +1,8 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package plugin diff --git a/cmd/server/app/service/role/role.go b/cmd/server/app/service/role/role.go index eade710285e935b09cd0f8964ce400817f31660e..73200cbb05c45fd1db95b04de03bc5b27eb51c7e 100644 --- a/cmd/server/app/service/role/role.go +++ b/cmd/server/app/service/role/role.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-04-27 15:32:50 - * LastEditTime: 2022-04-27 17:17:48 - * Description: 用户角色逻辑代码 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package role import ( diff --git a/cmd/server/app/service/script/script.go b/cmd/server/app/service/script/script.go index abd8e9bb8c99d446bd313ab66488e034916076fd..fb8d54f0e19bddd1450096f881e6e433ab4b2b25 100644 --- a/cmd/server/app/service/script/script.go +++ b/cmd/server/app/service/script/script.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package script import ( diff --git a/cmd/server/app/service/tag/tag.go b/cmd/server/app/service/tag/tag.go index 68795d7210c5426e37dbde27ef90a53af0cbb15f..0285f95bd7c7e4eed080c4321345017e8219aea1 100644 --- a/cmd/server/app/service/tag/tag.go +++ b/cmd/server/app/service/tag/tag.go @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package tag import ( diff --git a/cmd/server/app/service/user/user.go b/cmd/server/app/service/user/user.go index 4bd10d810191ab3835d6488bfd33cd70fb68f332..0998eb2d8333bad6d9f6695bb3645b7c77669ba3 100644 --- a/cmd/server/app/service/user/user.go +++ b/cmd/server/app/service/user/user.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2022-03-21 15:32:50 - * LastEditTime: 2023-09-04 13:54:45 - * Description: 用户模块逻辑代码 - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package user import ( diff --git a/cmd/server/main.go b/cmd/server/main.go index 6c22e134df1fb56b40f51125d8e5c8aa2ac3d77c..4cd7cd9727a0fefe9549038f4bc4a71ef166ef55 100644 --- a/cmd/server/main.go +++ b/cmd/server/main.go @@ -1,17 +1,10 @@ -/****************************************************************************** - * Copyright (c) KylinSoft Co., Ltd.2021-2022. All rights reserved. - * PilotGo is licensed under the Mulan PSL v2. - * You can use this software accodring to the terms and conditions of the Mulan PSL v2. - * You may obtain a copy of Mulan PSL v2 at: - *     http://license.coscl.org.cn/MulanPSL2 - * THIS SOFTWARE IS PROVIDED ON AN 'AS IS' BASIS, WITHOUT WARRANTIES OF ANY KIND, - * EITHER EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR PURPOSE. - * See the Mulan PSL v2 for more details. - * Author: zhanghan - * Date: 2021-11-18 10:25:52 - * LastEditTime: 2023-06-12 15:18:57 - * Description: server main - ******************************************************************************/ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: linjieren + * Date: Thu Jul 25 16:18:53 2024 +0800 + */ package main import ( diff --git a/frontend/env.d.ts b/frontend/env.d.ts index 5b53a15905653c5e56bcf10e9c84ed8bb99c44bf..284854abec2751f805f4e7b28f701db37cf027c3 100644 --- a/frontend/env.d.ts +++ b/frontend/env.d.ts @@ -1,3 +1,10 @@ +/* + * Copyright (c) KylinSoft Co., Ltd. 2024.All rights reserved. + * PilotGo licensed under the Mulan Permissive Software License, Version 2. + * See LICENSE file for more details. + * Author: Gzx1999 + * Date: Wed Jan 3 18:00:12 2024 +0800 + */ /// declare module '*.vue' { diff --git a/frontend/index.html b/frontend/index.html index 881fb4a780d351f691638ff830f31840ac0edfc9..7a6eb7aa771c8c5be591f1da281c6b1fd2072d37 100644 --- a/frontend/index.html +++ b/frontend/index.html @@ -1,3 +1,10 @@ + diff --git a/frontend/src/App.vue b/frontend/src/App.vue index d2234c304cb16a53e1c697a50825966f616406a0..6767a3d1214e89d0df188a8d2801390de00adcf8 100644 --- a/frontend/src/App.vue +++ b/frontend/src/App.vue @@ -1,3 +1,10 @@ +