本文整理汇总了C#中DotNetNuke.Security.Roles.RoleController.GetUserRoles方法的典型用法代码示例。如果您正苦于以下问题:C# RoleController.GetUserRoles方法的具体用法?C# RoleController.GetUserRoles怎么用?C# RoleController.GetUserRoles使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类DotNetNuke.Security.Roles.RoleController
的用法示例。
在下文中一共展示了RoleController.GetUserRoles方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DataBind
/// -----------------------------------------------------------------------------
/// <summary>
/// DataBind binds the data to the controls
/// </summary>
/// <history>
/// [cnurse] 03/13/2006 Created
/// </history>
/// -----------------------------------------------------------------------------
public override void DataBind()
{
if (Request.IsAuthenticated)
{
RoleController roleController = new RoleController();
grdServices.DataSource = roleController.GetUserRoles(UserInfo, false);
grdServices.DataBind();
//if no service available then hide options
ServicesRow.Visible = (grdServices.Items.Count > 0);
}
}
示例2: DataBind
/// <summary>
/// DataBind binds the data to the controls
/// </summary>
/// <history>
/// [cnurse] 03/13/2006 Created
/// </history>
public override void DataBind()
{
if( Services == 1 )
{
RoleController objRoles = new RoleController();
grdServices.DataSource = objRoles.GetUserRoles( PortalId );
grdServices.DataBind();
if( grdServices.Items.Count != 0 )
{
lblServices.Text = string.Format( Localization.GetString( "PleaseRegister", this.LocalResourceFile ), Globals.GetPortalDomainName( PortalAlias.HTTPAlias, Request, true ) + "/" + Globals.glbDefaultPage, TabId );
}
else
{
grdServices.Visible = false;
lblServices.Text = Localization.GetString( "MembershipNotOffered", this.LocalResourceFile );
}
lblServices.Visible = true;
grdServices.Columns[0].Visible = false; // subscribe
grdServices.Columns[9].Visible = false; // expiry date
}
else
{
if( Request.IsAuthenticated )
{
RoleController objRoles = new RoleController();
grdServices.DataSource = objRoles.GetUserRoles( PortalId, UserInfo.UserID, false );
grdServices.DataBind();
// if no service available then hide options
//ServicesRow.Visible = (grdServices.Items.Count > 0)
}
}
}
示例3: GetPagedDataSource
private IList<UserRoleInfo> GetPagedDataSource()
{
var objRoleController = new RoleController();
var roleName = RoleId != Null.NullInteger ? Role.RoleName : Null.NullString;
var userName = UserId != Null.NullInteger ? User.Username : Null.NullString;
var userList = objRoleController.GetUserRoles(PortalId, userName, roleName);
_totalRecords = userList.Count;
_totalPages = _totalRecords%PageSize == 0 ? _totalRecords/PageSize : _totalRecords/PageSize + 1;
return userList.Skip((CurrentPage - 1 )*PageSize).Take(PageSize).ToList();
}
示例4: CreateUserNotifications
/// -----------------------------------------------------------------------------
/// <summary>
/// CreateUserNotifications creates HtmlTextUser records and optionally sends email notifications to participants in a Workflow
/// </summary>
/// <remarks>
/// </remarks>
/// <param name="objHtmlText">An HtmlTextInfo object</param>
/// <history>
/// </history>
/// -----------------------------------------------------------------------------
private void CreateUserNotifications(HtmlTextInfo objHtmlText)
{
var _htmlTextUserController = new HtmlTextUserController();
HtmlTextUserInfo _htmlTextUser = null;
UserInfo _user = null;
// clean up old user notification records
_htmlTextUserController.DeleteHtmlTextUsers();
// ensure we have latest htmltext object loaded
objHtmlText = GetHtmlText(objHtmlText.ModuleID, objHtmlText.ItemID);
// build collection of users to notify
var objWorkflow = new WorkflowStateController();
var arrUsers = new ArrayList();
// if not published
if (objHtmlText.IsPublished == false)
{
arrUsers.Add(objHtmlText.CreatedByUserID); // include content owner
}
// if not draft and not published
if (objHtmlText.StateID != objWorkflow.GetFirstWorkflowStateID(objHtmlText.WorkflowID) && objHtmlText.IsPublished == false)
{
// get users from permissions for state
var objRoles = new RoleController();
foreach (WorkflowStatePermissionInfo permission in
WorkflowStatePermissionController.GetWorkflowStatePermissions(objHtmlText.StateID))
{
if (permission.AllowAccess)
{
if (Null.IsNull(permission.UserID))
{
int roleId = permission.RoleID;
RoleInfo objRole = TestableRoleController.Instance.GetRole(objHtmlText.PortalID, r => r.RoleID == roleId);
if ((objRole != null))
{
foreach (UserRoleInfo objUserRole in objRoles.GetUserRoles(objHtmlText.PortalID, null, objRole.RoleName))
{
if (!arrUsers.Contains(objUserRole.UserID))
{
arrUsers.Add(objUserRole.UserID);
}
}
}
}
else
{
if (!arrUsers.Contains(permission.UserID))
{
arrUsers.Add(permission.UserID);
}
}
}
}
}
// process notifications
if (arrUsers.Count > 0 || (objHtmlText.IsPublished && objHtmlText.Notify))
{
// get tabid from module
var objModules = new ModuleController();
ModuleInfo objModule = objModules.GetModule(objHtmlText.ModuleID);
PortalSettings objPortalSettings = PortalController.GetCurrentPortalSettings();
if (objPortalSettings != null)
{
string strResourceFile = string.Format("{0}/DesktopModules/{1}/{2}/{3}",
Globals.ApplicationPath,
objModule.DesktopModule.FolderName,
Localization.LocalResourceDirectory,
Localization.LocalSharedResourceFile);
string strSubject = Localization.GetString("NotificationSubject", strResourceFile);
string strBody = Localization.GetString("NotificationBody", strResourceFile);
strBody = strBody.Replace("[URL]", Globals.NavigateURL(objModule.TabID));
strBody = strBody.Replace("[STATE]", objHtmlText.StateName);
// process user notification collection
foreach (int intUserID in arrUsers)
{
// create user notification record
_htmlTextUser = new HtmlTextUserInfo();
_htmlTextUser.ItemID = objHtmlText.ItemID;
_htmlTextUser.StateID = objHtmlText.StateID;
_htmlTextUser.ModuleID = objHtmlText.ModuleID;
_htmlTextUser.TabID = objModule.TabID;
_htmlTextUser.UserID = intUserID;
_htmlTextUserController.AddHtmlTextUser(_htmlTextUser);
//.........这里部分代码省略.........
示例5: BindPortal
private void BindPortal(int portalId, string activeLanguage)
{
//Ensure localization
DataProvider.Instance().EnsureLocalizationExists(portalId, activeLanguage);
var portalController = new PortalController();
var portal = portalController.GetPortal(portalId, activeLanguage);
BindDetails(portal);
BindMarketing(portal);
ctlLogo.FilePath = portal.LogoFile;
ctlLogo.FileFilter = Globals.glbImageFileTypes;
ctlBackground.FilePath = portal.BackgroundFile;
ctlBackground.FileFilter = Globals.glbImageFileTypes;
ctlFavIcon.FilePath = new FavIcon(portal.PortalID).GetSettingPath();
chkSkinWidgestEnabled.Checked = PortalController.GetPortalSettingAsBoolean("EnableSkinWidgets", portalId, true);
BindSkins(portal);
BindPages(portal, activeLanguage);
lblHomeDirectory.Text = portal.HomeDirectory;
optUserRegistration.SelectedIndex = portal.UserRegistration;
BindPaymentProcessor(portal);
BindUsability(portal);
BindMessaging(portal);
var roleController = new RoleController();
cboAdministratorId.DataSource = roleController.GetUserRoles(portalId, null, portal.AdministratorRoleName);
cboAdministratorId.DataBind(portal.AdministratorId.ToString());
//PortalSettings for portal being edited
var portalSettings = new PortalSettings(portal);
cboTimeZone.DataBind(portalSettings.TimeZone.Id);
if (UserInfo.IsSuperUser)
{
BindAliases(portal);
BindSSLSettings(portal);
BindHostSettings(portal);
}
LoadStyleSheet(portal);
ctlAudit.Entity = portal;
var overrideDefaultSettings = Boolean.Parse(PortalController.GetPortalSetting(ClientResourceSettings.OverrideDefaultSettingsKey, portalId, "false"));
chkOverrideDefaultSettings.Checked = overrideDefaultSettings;
BindClientResourceManagementUi(portal.PortalID, overrideDefaultSettings);
ManageMinificationUi();
}
示例6: BindGrid
/// -----------------------------------------------------------------------------
/// <summary>
/// BindGrid loads the data grid from the Database
/// </summary>
/// <remarks>
/// </remarks>
/// <history>
/// [cnurse] 9/10/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
/// -----------------------------------------------------------------------------
private void BindGrid()
{
var objRoleController = new RoleController();
if (RoleId != Null.NullInteger)
{
cmdAdd.Text = Localization.GetString("AddUser.Text", LocalResourceFile);
grdUserRoles.DataKeyField = "UserId";
grdUserRoles.Columns[2].Visible = false;
grdUserRoles.DataSource = objRoleController.GetUserRoles(PortalId, null, Role.RoleName);
grdUserRoles.DataBind();
}
if (UserId != -1)
{
cmdAdd.Text = Localization.GetString("AddRole.Text", LocalResourceFile);
grdUserRoles.DataKeyField = "RoleId";
grdUserRoles.Columns[1].Visible = false;
grdUserRoles.DataSource = objRoleController.GetUserRoles(PortalId, User.Username, Null.NullString);
grdUserRoles.DataBind();
}
}
示例7: GetRoles
private ArrayList GetRoles(int portalId, int userId)
{
var objRoles = new RoleController();
return objRoles.GetUserRoles(portalId, userId, false);
}
示例8: DisplayExistingTickets
// Existing Tickets
#region DisplayExistingTickets
private void DisplayExistingTickets(HelpDesk_LastSearch objLastSearch)
{
string[] UsersRoles = UserInfo.Roles;
List<int> UsersRoleIDs = new List<int>();
string strSearchText = (objLastSearch.SearchText == null) ? "" : objLastSearch.SearchText;
HelpDeskDALDataContext objHelpDeskDALDataContext = new HelpDeskDALDataContext();
IQueryable<ExistingTasks> result = from HelpDesk_Tasks in objHelpDeskDALDataContext.HelpDesk_Tasks
where HelpDesk_Tasks.PortalID == PortalId
orderby HelpDesk_Tasks.CreatedDate descending
select new ExistingTasks
{
TaskID = HelpDesk_Tasks.TaskID,
Status = HelpDesk_Tasks.Status,
Priority = HelpDesk_Tasks.Priority,
DueDate = HelpDesk_Tasks.DueDate,
CreatedDate = HelpDesk_Tasks.CreatedDate,
Assigned = HelpDesk_Tasks.AssignedRoleID.ToString(),
Description = HelpDesk_Tasks.Description,
Requester = HelpDesk_Tasks.RequesterUserID.ToString(),
RequesterName = HelpDesk_Tasks.RequesterName
};
#region Only show users the records they should see
// Only show users the records they should see
if (!(UserInfo.IsInRole(GetAdminRole()) || UserInfo.IsInRole("Administrators") || UserInfo.IsSuperUser))
{
RoleController objRoleController = new RoleController();
foreach (RoleInfo objRoleInfo in objRoleController.GetUserRoles(UserInfo, true))
{
UsersRoleIDs.Add(objRoleInfo.RoleID);
}
result = from UsersRecords in result
where Convert.ToInt32(UsersRecords.Requester) == UserId ||
UsersRoleIDs.Contains(Convert.ToInt32(UsersRecords.Assigned))
select UsersRecords;
}
#endregion
#region Filter Status
// Filter Status
if (objLastSearch.Status != null)
{
result = from Status in result
where Status.Status == objLastSearch.Status
select Status;
}
#endregion
#region Filter Priority
// Filter Priority
if (objLastSearch.Priority != null)
{
result = from Priority in result
where Priority.Priority == objLastSearch.Priority
select Priority;
}
#endregion
#region Filter Assigned
// Filter Assigned
if (objLastSearch.AssignedRoleID.HasValue)
{
if (!(objLastSearch.AssignedRoleID == -2))
{
result = from Assigned in result
where Assigned.Assigned == objLastSearch.AssignedRoleID.ToString()
select Assigned;
}
}
#endregion
#region Filter DueDate
// Filter DueDate
if (objLastSearch.DueDate.HasValue)
{
result = from objDueDate in result
where objDueDate.DueDate > objLastSearch.DueDate
select objDueDate;
}
#endregion
#region Filter CreatedDate
// Filter CreatedDate
if (objLastSearch.CreatedDate.HasValue)
{
result = from CreatedDate in result
where CreatedDate.CreatedDate > objLastSearch.CreatedDate
select CreatedDate;
}
#endregion
#region Filter TextBox (Search)
// Filter TextBox
if (strSearchText.Trim().Length > 0)
//.........这里部分代码省略.........
示例9: BindData
private void BindData()
{
LocalizeModule();
if (ProfileTabId == Null.NullInteger)
{
rptGroupList.Visible = false;
litMessage.Text = string.Format(MESSAGE_ERROR_FORMAT, GetLocalizedString("SettingsEmpty.ErrorMessage"));
return;
}
if (ProfileId > Null.NullInteger)
{
// only show groups if this module is on a profile page
var ctlUser = new UserController();
var ctlRole = new RoleController();
var oUser = ctlUser.GetUser(PortalId, ProfileId);
// get a list of the groups that this site member is a part of
// This does not return the groups that only belong to this user like you expect. It returns all roles.
//var roles = ctlRole.GetUserRoles(oUser, false);
// This overload does.
//var roles = ctlRole.GetUserRoles(PortalId, oUser.Username, string.Empty);
var bindableRoles = from r in ctlRole.GetUserRoles(PortalId, oUser.Username, string.Empty)
where r.RoleType != 0 && r.Status == RoleStatus.Approved && r.SecurityMode == SecurityMode.SocialGroup
select r;
if (bindableRoles.Any())
{
/*
// some of the possibly helpful role properties for this module
roles[0].CreatedByUser(PortalId);
roles[0].CreatedByUserID;
roles[0].CreatedOnDate;
roles[0].Description;
roles[0].FullName;
roles[0].IconFile;
roles[0].IsOwner;
roles[0].IsPublic;
roles[0].PhotoURL;
roles[0].RoleName;
*/
// assign the roles to the repeater to be displayed
rptGroupList.DataSource = bindableRoles;
rptGroupList.DataBind();
// hide the message placeholder
litMessage.Visible = false;
}
else
{
// hide the repeater
rptGroupList.Visible = false;
// there are no roles for this user
litMessage.Text = string.Format(MESSAGE_FORMAT, GetLocalizedString("NoRoles.ErrorMessage"));
}
}
else
{
// send back a user-friendly message that this module cannot be used on this page
// hide the repeater
rptGroupList.Visible = false;
// there are no roles for this user
litMessage.Text = string.Format(MESSAGE_FORMAT, GetLocalizedString("WrongPage.ErrorMessage"));
}
}
示例10: BindData
/// <summary>
/// BindData binds the data from the DB to the controls
/// </summary>
/// <history>
/// [cnurse] 9/13/2004 Updated to reflect design changes for Help, 508 support
/// and localisation
/// </history>
private void BindData()
{
ModuleController objModules = new ModuleController();
userControl.ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
userControl.StartTabIndex = 1;
addressUser.ModuleId = objModules.GetModuleByDefinition( PortalId, "Site Settings" ).ModuleID;
addressUser.StartTabIndex = 9;
if( Services == 1 )
{
UserRow.Visible = false;
PasswordManagementRow.Visible = false;
RoleController objRoles = new RoleController();
grdServices.DataSource = objRoles.GetUserRoles( PortalId );
grdServices.DataBind();
if( grdServices.Items.Count != 0 )
{
lblServices.Text = string.Format(Localization.GetString("PleaseRegister", this.LocalResourceFile), Globals.GetPortalDomainName(PortalAlias.HTTPAlias, Request, true) + "/" + Globals.glbDefaultPage, TabId);
}
else
{
grdServices.Visible = false;
lblServices.Text = Localization.GetString( "MembershipNotOffered", this.LocalResourceFile );
}
lblServices.Visible = true;
grdServices.Columns[ 0 ].Visible = false; // subscribe
grdServices.Columns[ 9 ].Visible = false; // expiry date
ServicesRow.Visible = true;
}
else
{
UserRow.Visible = true;
//Populate the timezone combobox (look up timezone translations based on currently set culture)
Localization.LoadTimeZoneDropDownList( cboTimeZone, ( (PageBase)Page ).PageCulture.Name, Convert.ToString( PortalSettings.TimeZoneOffset ) );
Localization.LoadCultureDropDownList( cboLocale, CultureDropDownTypes.NativeName, ( (PageBase)Page ).PageCulture.Name );
if( cboLocale.Items.Count == 1 )
{
cboLocale.Enabled = false;
}
if( Request.IsAuthenticated )
{
lblRegister.Text = Localization.GetString( "RegisterNote", this.LocalResourceFile );
cmdRegister.Text = Localization.GetString( "cmdUpdate" );
PasswordManagementRow.Visible = true;
userControl.ShowPassword = false;
if( UserInfo.UserID >= 0 )
{
userControl.FirstName = UserInfo.FirstName;
userControl.LastName = UserInfo.LastName;
userControl.UserName = UserInfo.Username;
userControl.Email = UserInfo.Email;
userControl.IM = UserInfo.Profile.IM;
userControl.Website = UserInfo.Profile.Website;
if( cboTimeZone.Items.FindByValue( UserInfo.Profile.TimeZone.ToString() ) != null )
{
cboTimeZone.ClearSelection();
cboTimeZone.Items.FindByValue( UserInfo.Profile.TimeZone.ToString() ).Selected = true;
}
addressUser.Unit = UserInfo.Profile.Unit;
addressUser.Street = UserInfo.Profile.Street;
addressUser.City = UserInfo.Profile.City;
addressUser.Region = UserInfo.Profile.Region;
addressUser.Country = UserInfo.Profile.Country;
addressUser.Postal = UserInfo.Profile.PostalCode;
addressUser.Telephone = UserInfo.Profile.Telephone;
addressUser.Fax = UserInfo.Profile.Fax;
addressUser.Cell = UserInfo.Profile.Cell;
if( cboLocale.Items.FindByValue( UserInfo.Profile.PreferredLocale ) != null )
{
cboLocale.ClearSelection();
cboLocale.Items.FindByValue( UserInfo.Profile.PreferredLocale ).Selected = true;
}
}
RoleController objRoles = new RoleController();
grdServices.DataSource = objRoles.GetUserRoles( PortalId, UserInfo.UserID );
grdServices.DataBind();
if( UserInfo.IsSuperUser )
{
cmdUnregister.Visible = false;
ServicesRow.Visible = false;
//.........这里部分代码省略.........