本文整理汇总了C#中DotNetNuke.Entities.Users.UserInfo类的典型用法代码示例。如果您正苦于以下问题:C# UserInfo类的具体用法?C# UserInfo怎么用?C# UserInfo使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
UserInfo类属于DotNetNuke.Entities.Users命名空间,在下文中一共展示了UserInfo类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: GetProperty
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
{
TimeZoneInfo userTimeZone = AccessingUser.Profile.PreferredTimeZone;
switch (propertyName.ToLower())
{
case "current":
if (format == string.Empty)
{
format = "D";
}
return TimeZoneInfo.ConvertTime(DateTime.Now, userTimeZone).ToString(format, formatProvider);
case "now":
if (format == string.Empty)
{
format = "g";
}
return TimeZoneInfo.ConvertTime(DateTime.Now, userTimeZone).ToString(format, formatProvider);
case "system":
if (format == String.Empty)
{
format = "g";
}
return DateTime.Now.ToString(format, formatProvider);
case "utc":
if (format == String.Empty)
{
format = "g";
}
return DateTime.Now.ToUniversalTime().ToString(format, formatProvider);
default:
PropertyNotFound = true;
return string.Empty;
}
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:34,代码来源:DateTimePropertyAccess.cs
示例2: AddGroupNotification
internal virtual Notification AddGroupNotification(string notificationTypeName, int tabId, int moduleId, RoleInfo group, UserInfo initiatingUser, IList<RoleInfo> moderators, IList<UserInfo> recipients) {
var notificationType = NotificationsController.Instance.GetNotificationType(notificationTypeName);
var tokenReplace = new GroupItemTokenReplace(group);
var subject = Localization.GetString(notificationTypeName + ".Subject", Constants.SharedResourcesPath);
subject = tokenReplace.ReplaceGroupItemTokens(subject);
var body = Localization.GetString(notificationTypeName + ".Body", Constants.SharedResourcesPath);
body = tokenReplace.ReplaceGroupItemTokens(body);
body = body.Replace("Public.Text", Localization.GetString("Public.Text", Constants.SharedResourcesPath));
body = body.Replace("Private.Text", Localization.GetString("Private.Text", Constants.SharedResourcesPath));
bool dismiss = notificationTypeName != Constants.GroupPendingNotification;
var notification = new Notification
{
NotificationTypeID = notificationType.NotificationTypeId,
Subject = subject,
Body = body,
IncludeDismissAction = dismiss,
SenderUserID = initiatingUser.UserID,
Context = String.Format("{0}:{1}:{2}", tabId, moduleId, group.RoleID)
};
NotificationsController.Instance.SendNotification(notification, initiatingUser.PortalID, moderators, recipients);
return notification;
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:27,代码来源:Notifications.cs
示例3: ValueProviderWrapperForPropertyAccess
public ValueProviderWrapperForPropertyAccess(string name, IPropertyAccess source, UserInfo user, CultureInfo localization)
{
Name = name;
_source = source;
_user = user;
_loc = localization;
}
开发者ID:BravoSierra,项目名称:2sxc,代码行数:7,代码来源:ValueProviderWrapperForPropertyAccess.cs
示例4: UpdateTimeZoneInfo
private void UpdateTimeZoneInfo(UserInfo user, ProfilePropertyDefinitionCollection properties)
{
ProfilePropertyDefinition newTimeZone = properties["PreferredTimeZone"];
ProfilePropertyDefinition oldTimeZone = properties["TimeZone"];
if (newTimeZone != null && oldTimeZone != null)
{
//Old timezone is present but new is not...we will set that up.
if (!string.IsNullOrEmpty(oldTimeZone.PropertyValue) && string.IsNullOrEmpty(newTimeZone.PropertyValue))
{
int oldOffset;
int.TryParse(oldTimeZone.PropertyValue, out oldOffset);
TimeZoneInfo timeZoneInfo = Localization.ConvertLegacyTimeZoneOffsetToTimeZoneInfo(oldOffset);
newTimeZone.PropertyValue = timeZoneInfo.Id;
UpdateUserProfile(user);
}
//It's also possible that the new value is set but not the old value. We need to make them backwards compatible
else if (!string.IsNullOrEmpty(newTimeZone.PropertyValue) && string.IsNullOrEmpty(oldTimeZone.PropertyValue))
{
TimeZoneInfo timeZoneInfo = TimeZoneInfo.FindSystemTimeZoneById(newTimeZone.PropertyValue);
if (timeZoneInfo != null)
{
oldTimeZone.PropertyValue = timeZoneInfo.BaseUtcOffset.TotalMinutes.ToString(CultureInfo.InvariantCulture);
}
}
}
}
开发者ID:hungnt-me,项目名称:Dnn.Platform,代码行数:26,代码来源:DNNProfileProvider.cs
示例5: PortalSecurity_IsInRoles_NonAdmin_In_Deny_Role_Is_False
public void PortalSecurity_IsInRoles_NonAdmin_In_Deny_Role_Is_False()
{
var user = new UserInfo { IsSuperUser = false, UserID = UserId };
const string roles = "!SomeRoleName";
var portalSettings = SetupPortalSettings();
Assert.IsFalse(PortalSecurity.IsInRoles(user, portalSettings, roles));
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:7,代码来源:PermissionTests.cs
示例6: FloodControl
/// <summary>
/// cstor
/// </summary>
/// <param name="moduleId"></param>
/// <param name="tabId"></param>
/// <param name="ipAddress"></param>
/// <param name="user"></param>
public FloodControl(int moduleId, int tabId, string ipAddress, UserInfo user)
{
this.moduleId = moduleId;
this.tabId = tabId;
this.ipAddress = ipAddress;
this.user = user;
if (user != null)
{
//work out if the userinfo
//object has edit permission on this module
var moduleInfo = ModuleController.Instance.GetModule(moduleId, tabId, false);
hasEditAccess = ModulePermissionController
.HasModuleAccess(SecurityAccessLevel.Edit,
null,
moduleInfo);
//load the flood control settings
var settings = new ShoutBoxModuleSettings(moduleId, tabId);
floodTimePost = settings.FloodNewPost;
floodTimeReply = settings.FloodReply;
floodTimeVote = settings.FloodVoting;
}
}
开发者ID:markmcavoy,项目名称:ShoutboxSPA,代码行数:33,代码来源:FloodControl.cs
示例7: CreateJournalEntry
public static void CreateJournalEntry(RoleInfo roleInfo, UserInfo createdBy)
{
var journalController = JournalController.Instance;
var journalItem = new JournalItem();
string url = "";
if (roleInfo.Settings.ContainsKey("URL"))
{
url = roleInfo.Settings["URL"];
}
journalItem.PortalId = roleInfo.PortalID;
journalItem.ProfileId = createdBy.UserID;
journalItem.UserId = createdBy.UserID;
journalItem.Title = roleInfo.RoleName;
journalItem.ItemData = new ItemData {Url = url};
journalItem.SocialGroupId = roleInfo.RoleID;
journalItem.Summary = roleInfo.Description;
journalItem.Body = null;
journalItem.JournalTypeId = journalController.GetJournalType("groupcreate").JournalTypeId;
journalItem.ObjectKey = string.Format("groupcreate:{0}:{1}", roleInfo.RoleID.ToString(CultureInfo.InvariantCulture), createdBy.UserID.ToString(CultureInfo.InvariantCulture));
if (journalController.GetJournalItemByKey(roleInfo.PortalID, journalItem.ObjectKey) != null)
journalController.DeleteJournalItemByKey(roleInfo.PortalID, journalItem.ObjectKey);
journalItem.SecuritySet = string.Empty;
if (roleInfo.IsPublic)
journalItem.SecuritySet += "E,";
journalController.SaveJournalItem(journalItem, -1);
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:35,代码来源:GroupUtilities.cs
示例8: TicksPropertyAcccess_GetProperty_Returns_Correct_String
public void TicksPropertyAcccess_GetProperty_Returns_Correct_String(string propertyName)
{
//Arrange
var ticksPropertyAccess = new TicksPropertyAccess();
var accessingUser = new UserInfo();
long expected = DateTime.MinValue.Ticks;
switch (propertyName)
{
case "now":
expected = DateTime.Now.Ticks;
break;
case "today":
expected = DateTime.Today.Ticks;
break;
case "ticksperday":
expected = TimeSpan.TicksPerDay;
break;
}
//Act
bool propertyNotFound = false;
string propertyValue = ticksPropertyAccess.GetProperty(propertyName, "", CultureInfo.InvariantCulture,
accessingUser, Scope.DefaultSettings, ref propertyNotFound);
//Assert
Assert.AreEqual(expected.ToString(CultureInfo.InvariantCulture), propertyValue);
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:28,代码来源:PropertyAccessTests.cs
示例9: IsAuthorized
public override bool IsAuthorized(AuthFilterContext context)
{
if (SecurityLevel == SecurityAccessLevel.Anonymous)
{
return true;
}
User = HttpContextSource.Current.Request.IsAuthenticated ? UserController.Instance.GetCurrentUserInfo() : new UserInfo();
ContextSecurity security = new ContextSecurity(context.ActionContext.Request.FindModuleInfo());
switch (SecurityLevel)
{
case SecurityAccessLevel.Authenticated:
return User.UserID != -1;
case SecurityAccessLevel.Host:
return User.IsSuperUser;
case SecurityAccessLevel.Admin:
return security.IsAdmin;
case SecurityAccessLevel.Edit:
return security.CanEdit;
case SecurityAccessLevel.View:
return security.CanView;
case SecurityAccessLevel.Pilot:
return security.IsPilot;
case SecurityAccessLevel.Verifier:
return security.IsVerifier;
}
return false;
}
开发者ID:Club-Albatros,项目名称:Balises,代码行数:27,代码来源:BalisesAuthorizeAttribute.cs
示例10: AddSpeaker
public static int AddSpeaker(int portalId, int conferenceId, int userId, string email, string firstName, string lastName, string displayName, string company, int updatingUserId)
{
var user = UserController.Instance.GetUserById(portalId, userId);
if (user == null)
{
user = UserController.GetUserByEmail(portalId, email);
if (user == null)
{
user = new UserInfo() { PortalID = portalId, Username = email, Email = email, FirstName = firstName, LastName = lastName, DisplayName = displayName };
user.Membership.Password = UserController.GeneratePassword();
user.Membership.Approved = true;
user.Membership.UpdatePassword = true;
var res = UserController.CreateUser(ref user);
if (res != DotNetNuke.Security.Membership.UserCreateStatus.Success)
{
throw new System.Exception(res.ToString());
}
}
}
var speaker = SpeakerRepository.Instance.GetSpeaker(conferenceId, user.UserID);
if (speaker == null)
{
var s = new Models.Speakers.SpeakerBase() { ConferenceId = conferenceId, UserId = user.UserID, Company = company };
SpeakerRepository.Instance.AddSpeaker(s, updatingUserId);
}
DnnRoleController.CheckSpeaker(portalId, conferenceId, user.UserID);
return user.UserID;
}
开发者ID:DNN-Connect,项目名称:Conference,代码行数:28,代码来源:ConferenceController.cs
示例11: GetProperty
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo AccessingUser, Scope CurrentScope, ref bool PropertyNotFound)
{
switch (propertyName.ToLowerInvariant())
{
case "url":
return NewUrl(objParent.Language);
case "flagsrc":
return "/" + objParent.Language + ".gif";
case "selected":
return (objParent.Language == CultureInfo.CurrentCulture.Name).ToString();
case "label":
return Localization.GetString("Label", objParent.resourceFile);
case "i":
return Globals.ResolveUrl("~/images/Flags");
case "p":
return Globals.ResolveUrl(PathUtils.Instance.RemoveTrailingSlash(objPortal.HomeDirectory));
case "s":
return Globals.ResolveUrl(PathUtils.Instance.RemoveTrailingSlash(objPortal.ActiveTab.SkinPath));
case "g":
return Globals.ResolveUrl("~/portals/" + Globals.glbHostSkinFolder);
default:
PropertyNotFound = true;
return string.Empty;
}
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:25,代码来源:LanguageTokenReplace.cs
示例12: CreateNewUser
public UserCreateStatus CreateNewUser(string firstName, string lastName, string emailAddress, int portalId)
{
var ctlPortal = new PortalController();
var portalSettings = ctlPortal.GetPortals().Cast<PortalInfo>().FirstOrDefault(p => p.PortalID == portalId);
var user = new UserInfo()
{
FirstName = firstName,
LastName = lastName,
Email = emailAddress,
Username = emailAddress,
DisplayName = string.Concat(firstName, " ", lastName),
PortalID = portalId
};
user.Profile.PreferredLocale = portalSettings.DefaultLanguage;
user.Profile.FirstName = firstName;
user.Profile.LastName = lastName;
user.Membership.Approved = true;
user.Membership.Password = PasswordGenerator.GeneratePassword();
user.Membership.UpdatePassword = true;
var status = UserController.CreateUser(ref user);
User = user;
return status;
}
开发者ID:nvisionative,项目名称:dnnextensions,代码行数:29,代码来源:DnnUserController.cs
示例13: canUserAccessModule
/// <param name="moduleId"></param>
/// <param name="tabId"></param>
/// <param name="permissionKey">You can use the constants, but for modules there are only
/// those two</param>
/// <returns></returns>
public static bool canUserAccessModule(UserInfo user, int portalId, int tabId, ModuleInfo moduleInfo, string permissionKey)
{
var retVal = false;
string permissionsString = null;
if (moduleInfo.InheritViewPermissions)
{
var tabPermissionController = new TabPermissionController();
var tabPermissionCollection =
tabPermissionController.GetTabPermissionsCollectionByTabID(tabId, portalId);
permissionsString = tabPermissionController.GetTabPermissions(tabPermissionCollection, permissionKey);
}
else
{
var modulePermissionController = new ModulePermissionController();
var permissionCollection =
modulePermissionController.GetModulePermissionsCollectionByModuleID(moduleInfo.ModuleID, tabId);
permissionsString = modulePermissionController.GetModulePermissions(permissionCollection, permissionKey);
}
char[] splitter = { ';' };
var roles = permissionsString.Split(splitter);
foreach (var role in roles)
{
if (role.Length > 0)
{
if (user != null && user.IsInRole(role))
retVal = true;
else if (user == null && role.ToLower().Equals("all users"))
retVal = true;
}
}
return retVal;
}
开发者ID:BravoSierra,项目名称:2sxc,代码行数:39,代码来源:SecurityContext.cs
示例14: GetProperty
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo AccessingUser, Scope AccessLevel, ref bool PropertyNotFound)
{
if (obj == null)
{
return string.Empty;
}
return GetObjectProperty(obj, propertyName, format, formatProvider, ref PropertyNotFound);
}
开发者ID:rut5949,项目名称:Dnn.Platform,代码行数:8,代码来源:PropertyAccess.cs
示例15: GetProperty
/// <summary>
/// Get Preloaded Data Property.
/// </summary>
/// <param name="propertyName">property name.</param>
/// <param name="format">format.</param>
/// <param name="formatProvider">format provider.</param>
/// <param name="accessingUser">accessing user.</param>
/// <param name="accessLevel">access level.</param>
/// <param name="propertyNotFound">Whether found the property value.</param>
/// <returns></returns>
public string GetProperty(string propertyName, string format, CultureInfo formatProvider, UserInfo accessingUser, Scope accessLevel, ref bool propertyNotFound)
{
var contactList = _service.GetContacts(searchTerm, _portalId, pageIndex, pageSize);
var contacts = contactList
.Select(contact => new ContactViewModel(contact))
.ToList();
return "{ results: " + JsonConvert.SerializeObject(contacts) + ", pageCount: " + contactList.TotalCount + "}";
}
开发者ID:jbrinkman,项目名称:Dnn.Platform.Samples.Mvc,代码行数:18,代码来源:PreloadedDataPropertyAccess.cs
示例16: GroupViewParser
public GroupViewParser(PortalSettings portalSettings, RoleInfo roleInfo, UserInfo currentUser, string template, int groupViewTabId)
{
PortalSettings = portalSettings;
RoleInfo = roleInfo;
CurrentUser = currentUser;
Template = template;
GroupViewTabId = groupViewTabId;
}
开发者ID:revellado,项目名称:privateSocialGroups,代码行数:8,代码来源:GroupViewParser.cs
示例17: AssetEditor
public AssetEditor(App app, string path, UserInfo userInfo, PortalSettings portalSettings, bool global = false)
{
_app = app;
_userInfo = userInfo;
_portalSettings = portalSettings;
EditInfo = new AssetEditInfo(_app.AppId, _app.Name, path, global);
}
开发者ID:2sic,项目名称:2sxc,代码行数:8,代码来源:AssetEditor.cs
示例18: PortalSecurity_IsInRoles_Super_User_Is_Always_True
public void PortalSecurity_IsInRoles_Super_User_Is_Always_True()
{
var user = new UserInfo() { IsSuperUser = true, };
const string roles = "";
var portalSettings = SetupPortalSettings();
Assert.IsTrue(PortalSecurity.IsInRoles(user, portalSettings, roles));
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:8,代码来源:PermissionTests.cs
示例19: PortalSecurity_IsInRoles_All_Users_Role_Is_Always_True
public void PortalSecurity_IsInRoles_All_Users_Role_Is_Always_True()
{
var user = new UserInfo() { IsSuperUser = false, };
const string roles = Globals.glbRoleAllUsersName;
var portalSettings = SetupPortalSettings();
Assert.IsTrue(PortalSecurity.IsInRoles(user, portalSettings, roles));
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:8,代码来源:PermissionTests.cs
示例20: CreatePortal
public int CreatePortal(string portalName, UserInfo adminUser, string description, string keyWords, string templatePath,
string templateFile, string homeDirectory, string portalAlias,
string serverPath, string childPath, bool isChildPortal)
{
var template = GetPortalTemplate(Path.Combine(templatePath, templateFile), null);
return CreatePortal(portalName, adminUser, description, keyWords, template, homeDirectory, portalAlias,
serverPath, childPath, isChildPortal);
}
开发者ID:VegasoftTI,项目名称:Dnn.Platform,代码行数:9,代码来源:PortalController.cs
注:本文中的DotNetNuke.Entities.Users.UserInfo类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论