File tree Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Expand file tree Collapse file tree 2 files changed +6
-2
lines changed Original file line number Diff line number Diff line change @@ -45,6 +45,7 @@ pub enum ACTION {
4545 GetLicensePage ,
4646 GetImageByUrl ,
4747 GetPublicSettings ,
48+ AddTorrent ,
4849}
4950
5051pub struct Service {
@@ -184,10 +185,12 @@ impl CasbinConfiguration {
184185 admin, DeleteTorrent
185186 admin, BanUser
186187 admin, GetImageByUrl
188+ admin, AddTorrent
187189 registered, GetCategories
188190 registered, GetImageByUrl
189191 registered, GetPublicSettings
190192 registered, GetTags
193+ registered, AddTorrent
191194 guest, GetCategories
192195 guest, GetTags
193196 guest, GetAboutPage
Original file line number Diff line number Diff line change @@ -134,8 +134,9 @@ impl Index {
134134 add_torrent_req : AddTorrentRequest ,
135135 user_id : UserId ,
136136 ) -> Result < AddTorrentResponse , ServiceError > {
137- // Guard that the users exists
138- let _user = self . user_repository . get_compact ( & user_id) . await ?;
137+ self . authorization_service
138+ . authorize ( ACTION :: AddTorrent , Some ( user_id) )
139+ . await ?;
139140
140141 let metadata = self . validate_and_build_metadata ( & add_torrent_req) . await ?;
141142
You can’t perform that action at this time.
0 commit comments