@@ -29,12 +29,19 @@ public List<BlogRollItem> BlogRolls
2929 /// <param name="form">submitted form</param>
3030 public void Add ( NameValueCollection form )
3131 {
32+ if ( ! Security . IsAdministrator )
33+ throw new UnauthorizedAccessException ( ) ;
34+
3235 var br = new BlogRollItem ( ) ;
3336 br . Title = form [ "txtTitle" ] ;
3437 br . Description = form [ "txtDesc" ] ;
3538 br . BlogUrl = new Uri ( form [ "txtWebsite" ] ) ;
3639 br . FeedUrl = new Uri ( form [ "txtUrl" ] ) ;
3740 br . Xfn = GetXfn ( form ) ;
41+
42+ if ( string . IsNullOrEmpty ( br . Xfn ) )
43+ br . Xfn = "contact" ;
44+
3845 Providers . BlogService . InsertBlogRoll ( br ) ;
3946 }
4047 /// <summary>
@@ -44,6 +51,9 @@ public void Add(NameValueCollection form)
4451 /// <param name="id">Blogroll id</param>
4552 public void Update ( NameValueCollection form , string id )
4653 {
54+ if ( ! Security . IsAdministrator )
55+ throw new UnauthorizedAccessException ( ) ;
56+
4757 Guid gId ;
4858 if ( Guid . TryParse ( id , out gId ) )
4959 {
@@ -53,6 +63,10 @@ public void Update(NameValueCollection form, string id)
5363 br . BlogUrl = new Uri ( form [ "txtWebsite" ] ) ;
5464 br . FeedUrl = new Uri ( form [ "txtUrl" ] ) ;
5565 br . Xfn = GetXfn ( form ) ;
66+
67+ if ( string . IsNullOrEmpty ( br . Xfn ) )
68+ br . Xfn = "contact" ;
69+
5670 Providers . BlogService . UpdateBlogRoll ( br ) ;
5771 }
5872 else
@@ -66,6 +80,9 @@ public void Update(NameValueCollection form, string id)
6680 /// <param name="id">Blogroll ID</param>
6781 public void Delete ( string id )
6882 {
83+ if ( ! Security . IsAdministrator )
84+ throw new UnauthorizedAccessException ( ) ;
85+
6986 Guid gId ;
7087 if ( Guid . TryParse ( id , out gId ) )
7188 {
0 commit comments