温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:SpaceBuilder v1.0正式版源码
1////------------------------------------------------------------------------------ 2
// <copyright company="Tunynet"> 3
// Copyright (c) Tunynet Network Technology Co., Ltd. All rights reserved. 4
// </copyright> 5
//------------------------------------------------------------------------------ 6
7
//using System; 8
9
//using SpaceBuilder.Blogs.Components; 10
//using SpaceBuilder.Components; 11
//using SpaceBuilder.Controls; 12
//using SpaceBuilder.Controls.BaseClasses; 13
//using SpaceBuilder.Security; 14
//using SpaceBuilder.Posts.Permissions; 15
16
//namespace SpaceBuilder.Blogs.Controls 17
//{ 18
// /// <summary> 19
// /// 博客控件模版基类. 20
// /// </summary> 21
// public abstract class WeblogTemplatedWebControl : TemplatedWebControl 22
// { 23
// public WeblogTemplatedWebControl() 24
// : base() 25
// { 26
// _currentUser = SBContext.Current.User; 27
// } 28
29
// /// <summary> 30
// /// 检查Blog是否存在,并且用户是否有阅读的权限 31
// /// </summary> 32
// protected virtual void Authorize(Weblog w) 33
// { 34
// if (w == null) 35
// PermissionBase.RedirectOrExcpetion(SBExceptionType.SectionNotFound, string.Format("Weblog {0} could not be found", SBContext.Current.UserDomainName)); 36
37
// Permissions.AccessCheck(w, Permission.View, this.CurrentUser); 38
// } 39
40
// private Weblog _currentWeblog = null; 41
42
// /// <summary> 43
// /// Returns the CurrentWeb and calls Authorize 44
// /// </summary> 45
// public virtual Weblog CurrentWeblog 46
// { 47
// get 48
// { 49
// if ((_currentWeblog == null) || (!_currentWeblog.ApplicationKey.Equals(SBContext.Current.UserDomainName, StringComparison.CurrentCultureIgnoreCase))) 50
// { 51
// //ApplicationKey 与 UserDomainName 相同 52
// _currentWeblog = Weblogs.GetWeblog(SBContext.Current.UserDomainName,true,true); 53
54
// if (!this.CurrentUser.IsBlogAdministrator) 55
// Authorize(_currentWeblog); 56
// } 57
// return _currentWeblog; 58
// } 59
// } 60
61
// private User _currentUser = null; 62
// /// <summary> 63
// /// 当前访问此博客的用户 64
// /// </summary> 65
// protected User CurrentUser 66
// { 67
// get { return _currentUser; } 68
// } 69
70
// private User _currentDomainUser = null; 71
// /// <summary> 72
// /// 当前空间 拥有者 73
// /// </summary> 74
// public User CurrentDomainUser 75
// { 76
// get 77
// { 78
// if ((_currentDomainUser) == null || (!_currentDomainUser.UserName.Equals(SBContext.Current.UserDomainName,StringComparison.CurrentCultureIgnoreCase))) 79
// { 80
// if (CurrentUser.UserName.Equals(SBContext.Current.UserDomainName, StringComparison.CurrentCultureIgnoreCase)) 81
// _currentDomainUser = CurrentUser; 82
// else 83
// _currentDomainUser = Users.FindUserByUsername(SBContext.Current.UserDomainName); 84
// } 85
// return _currentDomainUser; 86
// } 87
// set { _currentDomainUser = value; } 88
// } 89
90
// } 91
//} 92



