From: <ro...@us...> - 2006-08-01 20:39:39
|
Revision: 255 Author: rouquin Date: 2006-08-01 13:39:33 -0700 (Tue, 01 Aug 2006) ViewCVS: http://svn.sourceforge.net/tcdb/?rev=255&view=rev Log Message: ----------- Forgot to add these in. Modified Paths: -------------- Website/Includes/Roles.ascx.cs Added Paths: ----------- Website/Includes/RoleAdmin.ascx Website/Includes/RoleAdmin.ascx.cs Added: Website/Includes/RoleAdmin.ascx =================================================================== --- Website/Includes/RoleAdmin.ascx (rev 0) +++ Website/Includes/RoleAdmin.ascx 2006-08-01 20:39:33 UTC (rev 255) @@ -0,0 +1,24 @@ +<%@ Control Language="C#" AutoEventWireup="true" CodeFile="RoleAdmin.ascx.cs" + Inherits="RoleAdmin" %> + +<table width="700"> + <tr> + <td align="center" valign="middle" style="height: 101px"> + <asp:DropDownList ID="roleList" runat="server" DataSourceID="RoleDataSource" DataTextField="roleName" + DataValueField="roleID"> + </asp:DropDownList><asp:ObjectDataSource ID="RoleDataSource" runat="server" OldValuesParameterFormatString="original_{0}" + SelectMethod="GetData" TypeName="tcdbDataSetTableAdapters.db_roleUserProductTableAdapter"> + <SelectParameters> + <asp:Parameter Name="userID" Type="Int32" /> + <asp:SessionParameter Name="productID" SessionField="product" Type="Int32" /> + <asp:Parameter DefaultValue="true" Name="active" Type="Boolean" /> + </SelectParameters> + </asp:ObjectDataSource> + <asp:LinkButton ID="addRoleBtn" runat="server" CommandName="addRole" OnCommand="addRole">Add User To Role</asp:LinkButton> + + <asp:LinkButton ID="newRoleBtn" runat="server" CommandName="newRole" OnCommand="newRole" OnInit="newRole_Init">New User Role</asp:LinkButton> + + <asp:LinkButton ID="newRightBtn" runat="server" CommandName="newRight" OnCommand="newRight" OnInit="newRight_Init">New User Right</asp:LinkButton><br /> + </td> + </tr> + </table> Added: Website/Includes/RoleAdmin.ascx.cs =================================================================== --- Website/Includes/RoleAdmin.ascx.cs (rev 0) +++ Website/Includes/RoleAdmin.ascx.cs 2006-08-01 20:39:33 UTC (rev 255) @@ -0,0 +1,55 @@ +using System; +using System.Data; +using System.Configuration; +using System.Web; +using System.Web.Security; +using System.Web.UI; +using System.Web.UI.WebControls; +using System.Web.UI.WebControls.WebParts; +using System.Web.UI.HtmlControls; +using System.Collections.Generic; +using TCDB.Assignments; +using TCDB.Common; +using TCDB.Products; +using TCDB.Users; +using log4net; + +public partial class RoleAdmin : SiteUserControl +{ + private static ILog m_logg = LogManager.GetLogger("Page:Authenticate"); + int product = Convert.ToInt32(HttpContext.Current.Request.QueryString[Constants.CODE_PRODUCT]); + + protected void Page_Load(object sender, EventArgs e) + { + } + protected void addRole(object sender, CommandEventArgs e) + { + Response.Redirect("Role.aspx?mode=edit&" + Constants.CODE_PRODUCT + "=" + product + "&" + Constants.CODE_ROLE + "=" + roleList.SelectedValue); + } + + protected void newRole(object sender, CommandEventArgs e) + { + Response.Redirect("Role.aspx?mode=new&" + Constants.CODE_PRODUCT + "=" + product); + } + + protected void newRight(object sender, CommandEventArgs e) + { + Response.Redirect("Right.aspx?mode=new&" + Constants.CODE_PRODUCT + "=" + product); + } + + protected void newRole_Init(object sender, EventArgs e) + { + LinkButton newRole = (LinkButton)sender; + + if (!m_user.HasRight("create_role", Constants.PRODUCT_ANYID)) + newRole.Visible = false; + } + + protected void newRight_Init(object sender, EventArgs e) + { + LinkButton newRight = (LinkButton) sender; + + if (!m_user.HasRight("dev_access", Constants.PRODUCT_ANYID)) + newRight.Visible = false; + } +} Modified: Website/Includes/Roles.ascx.cs =================================================================== --- Website/Includes/Roles.ascx.cs 2006-08-01 20:32:03 UTC (rev 254) +++ Website/Includes/Roles.ascx.cs 2006-08-01 20:39:33 UTC (rev 255) @@ -203,17 +203,21 @@ Dictionary<String, ArrayList> ProductUsers = (Dictionary<String, ArrayList>)Session["ProductUsers"]; // update selected product - String productID = Session["product"].ToString(); - Session["product"] = productList.SelectedValue; + String productID; + if (Session["product"] != null) + { + productID = Session["product"].ToString(); - // Update ProductUsers - int[] indices = userList.GetSelectedIndices(); - ArrayList users = new ArrayList(); - foreach (int index in indices) - users.Add(userList.Items[index].Value); - if (ProductUsers.ContainsKey(productID)) - ProductUsers[productID] = users; + // Update ProductUsers + int[] indices = userList.GetSelectedIndices(); + ArrayList users = new ArrayList(); + foreach (int index in indices) + users.Add(userList.Items[index].Value); + if (ProductUsers.ContainsKey(productID)) + ProductUsers[productID] = users; + } + Session["product"] = productList.SelectedValue; // Update userlist userList.DataBind(); } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |