22using System . Collections . Generic ;
33using System . Linq ;
44using System . Linq . Dynamic ;
5- using System . Text ;
6- using System . Threading . Tasks ;
75using BlogEngine . Core . Data . Models ;
8- using BlogEngine . Core . Web . Navigation ;
96using BlogEngine . Core . Data . Contracts ;
107
118namespace BlogEngine . Core . Data
@@ -26,8 +23,8 @@ public class TrashRepository : ITrashRepository
2623 /// <returns></returns>
2724 public TrashVM GetTrash ( TrashType trashType , int take = 10 , int skip = 0 , string filter = "1 == 1" , string order = "DateCreated descending" )
2825 {
29- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . AccessAdminPages ) )
30- throw new System . UnauthorizedAccessException ( ) ;
26+ if ( ! Security . IsAuthorizedTo ( Rights . AccessAdminPages ) )
27+ throw new UnauthorizedAccessException ( ) ;
3128
3229 var trash = new TrashVM ( ) ;
3330 var comments = new List < Comment > ( ) ;
@@ -43,7 +40,7 @@ public TrashVM GetTrash(TrashType trashType, int take = 10, int skip = 0, string
4340
4441 foreach ( var p in Post . Posts )
4542 {
46- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . EditOtherUsersPosts ) )
43+ if ( ! Security . IsAuthorizedTo ( Rights . EditOtherUsersPosts ) )
4744 if ( p . Author . ToLower ( ) != Security . CurrentUser . Identity . Name . ToLower ( ) )
4845 continue ;
4946
@@ -78,7 +75,7 @@ public TrashVM GetTrash(TrashType trashType, int take = 10, int skip = 0, string
7875 {
7976 foreach ( var p in posts )
8077 {
81- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . EditOtherUsersPosts ) )
78+ if ( ! Security . IsAuthorizedTo ( Rights . EditOtherUsersPosts ) )
8279 if ( p . Author . ToLower ( ) != Security . CurrentUser . Identity . Name . ToLower ( ) )
8380 continue ;
8481
@@ -138,7 +135,7 @@ public TrashVM GetTrash(TrashType trashType, int take = 10, int skip = 0, string
138135 /// <param name="id">Id</param>
139136 public bool Restore ( string trashType , Guid id )
140137 {
141- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . AccessAdminPages ) )
138+ if ( ! Security . IsAuthorizedTo ( Rights . AccessAdminPages ) )
142139 throw new System . UnauthorizedAccessException ( ) ;
143140
144141 switch ( trashType )
@@ -175,7 +172,7 @@ public bool Restore(string trashType, Guid id)
175172 /// <param name="id">Id</param>
176173 public bool Purge ( string trashType , Guid id )
177174 {
178- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . AccessAdminPages ) )
175+ if ( ! Security . IsAuthorizedTo ( Rights . AccessAdminPages ) )
179176 throw new System . UnauthorizedAccessException ( ) ;
180177
181178 switch ( trashType )
@@ -210,13 +207,13 @@ public bool Purge(string trashType, Guid id)
210207 /// </summary>
211208 public bool PurgeAll ( )
212209 {
213- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . AccessAdminPages ) )
210+ if ( ! Security . IsAuthorizedTo ( Rights . AccessAdminPages ) )
214211 throw new System . UnauthorizedAccessException ( ) ;
215212
216213 // remove deleted comments
217214 foreach ( var p in Post . Posts . ToArray ( ) )
218215 {
219- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . EditOtherUsersPosts ) )
216+ if ( ! Security . IsAuthorizedTo ( Rights . EditOtherUsersPosts ) )
220217 if ( p . Author . ToLower ( ) != Security . CurrentUser . Identity . Name . ToLower ( ) )
221218 continue ;
222219
@@ -229,7 +226,7 @@ public bool PurgeAll()
229226 // remove deleted posts
230227 foreach ( var p in Post . DeletedPosts . ToArray ( ) )
231228 {
232- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . EditOtherUsersPosts ) )
229+ if ( ! Security . IsAuthorizedTo ( Rights . EditOtherUsersPosts ) )
233230 if ( p . Author . ToLower ( ) != Security . CurrentUser . Identity . Name . ToLower ( ) )
234231 continue ;
235232
@@ -251,8 +248,8 @@ public bool PurgeAll()
251248 /// <returns></returns>
252249 public JsonResponse PurgeLogfile ( )
253250 {
254- if ( ! Security . IsAuthorizedTo ( BlogEngine . Core . Rights . AccessAdminPages ) )
255- throw new System . UnauthorizedAccessException ( ) ;
251+ if ( ! Security . IsAuthorizedTo ( Rights . AccessAdminPages ) )
252+ throw new UnauthorizedAccessException ( ) ;
256253
257254 string fileLocation = System . Web . Hosting . HostingEnvironment . MapPath ( System . IO . Path . Combine ( BlogConfig . StorageLocation , "logger.txt" ) ) ;
258255 if ( System . IO . File . Exists ( fileLocation ) )
0 commit comments