@@ -88,16 +88,18 @@ impl CasbinEnforcer {
88
88
pub async fn new ( ) -> Self {
89
89
let casbin_configuration = CasbinConfiguration :: new ( ) ;
90
90
91
- let model = DefaultModel :: from_str ( & casbin_configuration. model ) . await . unwrap ( ) ;
91
+ let model = DefaultModel :: from_str ( & casbin_configuration. model )
92
+ . await
93
+ . expect ( "Error loading the model" ) ;
92
94
93
95
let policy = casbin_configuration. policy ;
94
96
95
- let mut enforcer = Enforcer :: new ( model, ( ) ) . await . unwrap ( ) ;
97
+ let mut enforcer = Enforcer :: new ( model, ( ) ) . await . expect ( "Error creating the enforcer" ) ;
96
98
97
- enforcer. add_policies ( policy) . await . unwrap ( ) ;
99
+ enforcer. add_policies ( policy) . await . expect ( "Error loading the policy" ) ;
98
100
99
101
let enforcer = Arc :: new ( RwLock :: new ( enforcer) ) ;
100
- //casbin_enforcer.enable_log(true);
102
+
101
103
Self { enforcer }
102
104
}
103
105
}
@@ -126,14 +128,14 @@ impl CasbinConfiguration {
126
128
" ,
127
129
) ,
128
130
policy : vec ! [
129
- vec![ "admin" . to_owned ( ) , "AddCategory" . to_owned ( ) ] ,
130
- vec![ "admin" . to_owned ( ) , "DeleteCategory" . to_owned ( ) ] ,
131
- vec![ "admin" . to_owned ( ) , "GetSettings" . to_owned ( ) ] ,
132
- vec![ "admin" . to_owned ( ) , "GetSettingsSecret" . to_owned ( ) ] ,
133
- vec![ "admin" . to_owned ( ) , "AddTag" . to_owned ( ) ] ,
134
- vec![ "admin" . to_owned ( ) , "DeleteTag" . to_owned ( ) ] ,
135
- vec![ "admin" . to_owned ( ) , "DeleteTorrent" . to_owned ( ) ] ,
136
- vec![ "admin" . to_owned ( ) , "BanUser" . to_owned ( ) ] ,
131
+ vec![ "admin" . to_string ( ) , "AddCategory" . to_string ( ) ] ,
132
+ vec![ "admin" . to_string ( ) , "DeleteCategory" . to_string ( ) ] ,
133
+ vec![ "admin" . to_string ( ) , "GetSettings" . to_string ( ) ] ,
134
+ vec![ "admin" . to_string ( ) , "GetSettingsSecret" . to_string ( ) ] ,
135
+ vec![ "admin" . to_string ( ) , "AddTag" . to_string ( ) ] ,
136
+ vec![ "admin" . to_string ( ) , "DeleteTag" . to_string ( ) ] ,
137
+ vec![ "admin" . to_string ( ) , "DeleteTorrent" . to_string ( ) ] ,
138
+ vec![ "admin" . to_string ( ) , "BanUser" . to_string ( ) ] ,
137
139
] ,
138
140
}
139
141
}
0 commit comments