From 05e6dbe6e14a12bea9699bdb17ec0457042d2893 Mon Sep 17 00:00:00 2001 From: gazebo Date: Tue, 13 Aug 2019 16:27:48 +0800 Subject: [PATCH] =?UTF-8?q?-=20casbin=20model=E6=96=87=E4=BB=B6=E7=A7=BB?= =?UTF-8?q?=E5=88=B0conf=E4=B8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- {business/authz/casbinauth => conf}/rbac_model.conf | 0 deploy/ansible.yml | 4 ++-- globals/api2/api2.go | 8 +++++++- main.go | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) rename {business/authz/casbinauth => conf}/rbac_model.conf (100%) diff --git a/business/authz/casbinauth/rbac_model.conf b/conf/rbac_model.conf similarity index 100% rename from business/authz/casbinauth/rbac_model.conf rename to conf/rbac_model.conf diff --git a/deploy/ansible.yml b/deploy/ansible.yml index fa3727889..cc372ac79 100644 --- a/deploy/ansible.yml +++ b/deploy/ansible.yml @@ -21,8 +21,8 @@ backup: yes - name: copy conf file to dest copy: - src: ../conf/app.conf - dest: "{{ deploy_dir }}/conf/app.conf" + src: ../conf/ + dest: "{{ deploy_dir }}/conf/" owner: ubuntu group: ubuntu mode: 0555 diff --git a/globals/api2/api2.go b/globals/api2/api2.go index a781b3e4e..25b901f0a 100644 --- a/globals/api2/api2.go +++ b/globals/api2/api2.go @@ -3,6 +3,7 @@ package api2 import ( "git.rosy.net.cn/jx-callback/business/authz" "git.rosy.net.cn/jx-callback/business/authz/casbinauth" + "git.rosy.net.cn/jx-callback/globals" ) var ( @@ -10,5 +11,10 @@ var ( ) func Init() { - RoleMan, _ = casbinauth.New("business/authz/casbinauth/rbac_model.conf") + RoleMan2, err := casbinauth.New("conf/rbac_model.conf") + if err != nil { + globals.SugarLogger.Error(err.Error()) + } else { + RoleMan = RoleMan2 + } } diff --git a/main.go b/main.go index 3ffde2b59..635de768e 100644 --- a/main.go +++ b/main.go @@ -47,7 +47,9 @@ var ( func Init() { beegodb.Init() - api2.Init() + if globals.EnableWXAuth2 { + api2.Init() + } defsch.Init() buildTime, err := time.ParseInLocation(time.RFC3339, BuildDate, time.UTC)