//---------------------------------------------------------------------------------------//
        protected void Page_Load(object sender, EventArgs e)
        {
            userID = -1;
            currentUser = new User();
            if ((Session != null) && (Session["UserID"] != null))
            {
                userID = Convert.ToInt32(Session["UserID"]);
                currentUser = wrapper.GetUsersWrapper(new int[] { userID })[0];
            }

            if (!IsPostBack)
            {
                if (Request.Params["ex"] != null)
                    excep = Server.GetLastError();

                String optList = ConfigurationManager.AppSettings["bugReportOptions"];
                if ((optList != null) && (optList.Length > 0))
                {
                    char[] delimiter = { ',' };
                    String[] options = optList.Split(delimiter, 100);
                    for (int i = 0; i < options.Length; i++)
                    {
                        //ddlArea.Items.Add(new ListItem(options[i],i.ToString()));
                        ddlBugType.Items.Add(options[i]);
                    }
                    if (options.Length > 0)
                    {
                        ddlBugType.Items[0].Selected = false;
                    }
                }
                // TO DO: this is not what I would expect
                IntTag[] ls = wrapper.GetProcessAgentTagsByTypeWrapper(ProcessAgentType.LAB_SERVER);

                ddlBugType.Items.Add("Content - need to change");
                foreach (IntTag l in ls)
                {
                    ddlBugType.Items.Add(new ListItem(l.tag, l.id.ToString()));
                }
            }
        }
		private void DisplayUserInfo(User user)
		{
			ResetState();
            hdnUserId.Value = user.userID.ToString();
			txtUsername.Text = user.userName;
			txtUsername.Enabled = false;
			txtFirstName.Text = user.firstName;
			txtLastName.Text = user.lastName;
			txtEmail.Text = user.email;
            ddlAuthority.SelectedValue = user.authID.ToString();
            ddlAuthority.Enabled = false;

			/* Note if you change your drop down list options after launching the SB, */
			if(ConfigurationManager.AppSettings["useAffiliationDDL"].Equals("true"))
			{
                ListItem liAffil = ddlAffiliation.Items.FindByText(user.affiliation);
                if (liAffil == null)
                {
                    ddlAffiliation.Items.Add(user.affiliation);
                }
				ddlAffiliation.Items.FindByText (user.affiliation).Selected = true;
			}
			else
			{
				txtAffiliation.Text = user.affiliation;
			}

			cbxLockAccount.Checked = user.lockAccount ;

			try
			{
				//Get explicit groups the user belongs to
				ArrayList nonRequestGroups = new ArrayList();
				ArrayList requestGroups = new ArrayList();
				int[] gpIDs = wrapper.ListGroupsForUserWrapper (user.userID );
                //int[] gpIDs = wrapper.ListGroupsForUserWrapper(user.userID);
				ServiceBroker.Administration.Group[] gps=wrapper.GetGroupsWrapper(gpIDs);
				foreach(ServiceBroker.Administration.Group g in gps)
				{
					if (g.GroupType.CompareTo(GroupType.REQUEST) == 0)
						requestGroups.Add(g);
					else 
						if(!g.groupName.Equals("NewUserGroup"))
						nonRequestGroups.Add(g);	
				}

				string groupsDisplay = "'"+user.userName + "'"+" is a member of the following groups:" + "<p>";
				if ((nonRequestGroups!=null)&& (nonRequestGroups.Count>0))
				{
					foreach (ServiceBroker.Administration.Group g in nonRequestGroups)
					{
						groupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;"+ g.groupName+ "<br>";
					}
				}
				else
				{
					groupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;no group <br>";
				}
					
				lblGroups.Text = groupsDisplay;

				string requestGroupsDisplay = "'"+user.userName + "'"+" has requested membership in the following groups:" + "<p>";
				if ((requestGroups!=null)&& (requestGroups.Count>0))
				{
					foreach (Administration.Group g in requestGroups)
					{
						int origGroupID = AdministrativeAPI.GetAssociatedGroupID(g.groupID);
						string origGroupName = AdministrativeAPI.GetGroups(new int[] {origGroupID})[0].groupName;
						requestGroupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;"+ origGroupName+ "<br>";
					}
				}
				else
				{
					requestGroupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;no group <br>";
				}
				lblRequestGroups.Text=requestGroupsDisplay;

				if (!Session["GroupName"].ToString().Equals(ServiceBroker.Administration.Group.SUPERUSER))
				{
					btnSaveChanges.Enabled=false;
					btnSaveChanges.CssClass="buttongray";
				}
			}

			catch (Exception ex)
			{
				string msg = "Exception: Trouble accessing page. "+ex.Message+". "+ex.GetBaseException();
				lblResponse.Text = Utilities.FormatErrorMessage(msg);
				lblResponse.Visible = true;
			}
		}
Example #3
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            userID = -1;
            currentUser = new User();
            if((Session != null) && (Session["UserID"] != null))
            {
                userID = Convert.ToInt32(Session["UserID"]);
                currentUser = wrapper.GetUsersWrapper(new int[] {userID})[0];
            }

            if(! IsPostBack)
            {
                if (userID != -1) //user logged in
                {
                    lblUserName.Visible = false;
                    lblEmail.Visible = false;
                    txtUserName.Visible = false;
                    txtEmail.Visible = false;
                }

                int[] lsIDs = AdministrativeAPI.ListLabServerIDs();
                ProcessAgentInfo[] ls = wrapper.GetProcessAgentInfosWrapper(lsIDs);
                //ddlWhichLab.Items.Add("System-wide error");

                String optList = ConfigurationSettings.AppSettings["helpOptions"];
                if((optList != null)&& (optList.Length >0)){
                    char [] delimiter = {','};
                    String [] options =optList.Split(delimiter,100);
                    for(int i =0;i< options.Length;i++)
                    {
                        //ddlHelpType.Items.Add(new ListItem(options[i],i.ToString()));
                        ddlHelpType.Items.Add(options[i]);
                    }
                    if(options.Length > 0)
                    {
                        ddlHelpType.Items[0].Selected = false;
                    }
                }

                foreach (ProcessAgentInfo l in ls)
                {
                        ddlHelpType.Items.Add(new ListItem(l.agentName));
                }

            }
        }
Example #4
0
        private void Page_Load(object sender, System.EventArgs e)
        {
            if (Request.UserAgent.Contains("MSIE 6") || Request.UserAgent.Contains("MSIE 7"))
            {
               recaptcha.EmbedJavascript = true;
            }
            lblRevision.Text = "<!--  " + iLabGlobal.Release + "  -->";
            userID = -1;
            currentUser = new User();
            if((Session != null) && (Session["UserID"] != null))
            {
                userID = Convert.ToInt32(Session["UserID"]);
                currentUser = wrapper.GetUsersWrapper(new int[] {userID})[0];
            }
            //recaptcha.PublicKey = "6LcLF8ISAAAAAMhwOM1ipf9N1Kh_obO1VG0PwCQB";
            //recaptcha.PrivateKey = "6LcLF8ISAAAAALHhc_wOQibhl3jIc5gf9MUKvOw_";
            if(! IsPostBack)
            {

                if (userID != -1) //user logged in
                {
                    lblUserName.Visible = false;
                    lblEmail.Visible = false;
                    txtUserName.Visible = false;
                    txtEmail.Visible = false;
                }

                int[] lsIDs = AdministrativeAPI.ListLabServerIDs();
                ProcessAgentInfo[] ls = wrapper.GetProcessAgentInfosWrapper(lsIDs);
                //ddlWhichLab.Items.Add("System-wide error");

                String optList = ConfigurationManager.AppSettings["helpOptions"];
                if((optList != null)&& (optList.Length >0)){
                    char [] delimiter = {','};
                    String [] options =optList.Split(delimiter,100);
                    for(int i =0;i< options.Length;i++)
                    {
                        //ddlHelpType.Items.Add(new ListItem(options[i],i.ToString()));
                        ddlHelpType.Items.Add(options[i]);
                    }
                    if(options.Length > 0)
                    {
                        ddlHelpType.Items[0].Selected = false;
                    }
                }

                foreach (ProcessAgentInfo l in ls)
                {
                        ddlHelpType.Items.Add(new ListItem(l.agentName));
                }

            }
        }
        /// <summary>
        /// to retrieve user metadata for users specified by array of users 
        /// </summary>
        public static User[] SelectUsers( int[] userIDs )
        {
            List<User> users = new List<User>();

            DbConnection myConnection = FactoryDB.GetConnection();
            DbCommand myCommand = FactoryDB.CreateCommand("User_Retrieve", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;
            myCommand.Parameters .Add(FactoryDB.CreateParameter( "@userID",null, DbType.Int32));

            try
            {
                myConnection.Open ();

                for (int i =0; i < userIDs.Length ; i++)
                {
                    myCommand.Parameters["@userID"].Value = userIDs[i];

                    // get User info from table users
                    DbDataReader myReader = myCommand.ExecuteReader ();
                    while(myReader.Read ())
                    {
                        User u = new User();
                        u.userID = userIDs[i];

                        if (myReader["auth_id"] != System.DBNull.Value)
                            u.authID = Convert.ToInt32(myReader["auth_id"]);
                        if(myReader["user_name"] != System.DBNull.Value )
                            u.userName= (string) myReader["user_name"];
                        if(myReader["first_name"] != System.DBNull.Value )
                            u.firstName= (string) myReader["first_name"];
                        if(myReader["last_name"] != System.DBNull.Value )
                            u.lastName= (string) myReader["last_name"];
                        if(myReader["email"] != System.DBNull .Value )
                            u.email= (string) myReader["email"];
                        if(myReader["affiliation"] != System.DBNull.Value )
                            u.affiliation= (string) myReader["affiliation"];
                        if(myReader["xml_extension"] != System.DBNull.Value )
                            u.xmlExtension = (string) myReader["xml_extension"];
                        if(myReader["signup_reason"] != System.DBNull .Value )
                            u.reason= (string) myReader["signup_reason"];
                        if(myReader["date_created"] != System.DBNull .Value)
                            u.registrationDate = (DateTime) myReader["date_created"];
                        if (Convert.ToInt16(myReader["lock_user"]) == 0)
                            u.lockAccount = false;
                        else u.lockAccount = true;
                        users.Add(u);
                    }
                    myReader.Close ();
                }
            }
            catch (Exception ex)
            {
                throw new Exception("Exception thrown SelectUsers",ex);
            }
            finally
            {
                myConnection.Close ();
            }
            users.Sort();
            return users.ToArray(); ;
        }
 /// <summary>
 /// to modify a user
 /// The previous call used to be
 /// public static void UpdateUser(User user, string principalID, string authenticationType)
 /// principalID was changed to principalString a while ago
 /// </summary>
 public static void UpdateUser(User user, int authorityID, int authenticationTypeID)
 {
     UpdateUser(user.userID,user.userName,authorityID,authenticationTypeID,user.firstName,user.lastName,user.email,
         user.affiliation,user.reason,user.xmlExtension,user.lockAccount);
 }
        protected void Page_Load(object sender, System.EventArgs e)
        {
            AuthorizationWrapperClass wrapper = new AuthorizationWrapperClass();

            if(! IsPostBack)
            {
                LoadAuthorityList();
                //Populate textboxes with User's data
                User sessionUser = new User();
                sessionUser = wrapper.GetUsersWrapper(new int[]{Convert.ToInt32(Session["UserID"])})[0];

                txtUsername.Text = sessionUser.userName;
                txtFirstName.Text = sessionUser.firstName;
                txtLastName.Text = sessionUser.lastName;
                txtEmail.Text = sessionUser.email;
                txtNewPassword.Text = "";
                txtConfirmPassword.Text = "";
                ddlAuthorities.SelectedValue = sessionUser.authID.ToString();
                ddlAuthorities.Enabled = false;

                // To list all the groups a user belongs to
                int userID = Convert.ToInt32(Session["UserID"]);
                int[] groupIDs = wrapper.ListGroupsForUserWrapper (userID);

                //since we already have the groups a user has access
                // if we use wrapper here, it will deny authentication
                Group[] gps = AdministrativeAPI.GetGroups(groupIDs);
                ArrayList nonRequestGroups = new ArrayList();
                ArrayList requestGroups = new ArrayList();

                foreach(Group g in gps)
                {
                    if (g.groupName.EndsWith("request"))
                        requestGroups.Add(g);
                    else
                        if(!g.groupName.Equals("NewUserGroup"))
                        nonRequestGroups.Add(g);
                }

                //List Groups that user belongs to in blue box
                if ((nonRequestGroups!=null)&& (nonRequestGroups.Count>0))
                {
                    for (int i=0;i<nonRequestGroups.Count;i++)
                    {
                        lblGroups.Text+= ((Group)nonRequestGroups[i]).groupName;
                        if (i != nonRequestGroups.Count-1)
                            lblGroups.Text +=", ";
                    }
                }
                else
                {
                    lblGroups.Text = "No group";
                }

                //List Groups that user has requested to in blue box
                if ((requestGroups!=null)&& (requestGroups.Count>0))
                {
                    for (int i=0;i<requestGroups.Count;i++)
                    {
                        int origGroupID = AdministrativeAPI.GetAssociatedGroupID(((Group)requestGroups[i]).groupID);
                        string origGroupName = AdministrativeAPI.GetGroups(new int[] {origGroupID})[0].groupName;
                        lblRequestGroups.Text+= origGroupName;
                        if (i != requestGroups.Count-1)
                            lblRequestGroups.Text +=", ";
                    }
                }
                else
                {
                    lblRequestGroups.Text = "No group";
                }
            }
        }
 /* !------------------------------------------------------------------------------!
  *							CALLS FOR USERS
  * !------------------------------------------------------------------------------!
  */
 /// <summary>
 /// to add a user
 /// The previous call used to be
 /// public static void InsertUser(User user, string principalID, string authenticationType, string initialGroupID)
 /// principal ID is automatically generated by the principals table.
 /// </summary>
 public static int InsertUser(User user, int authenticationTypeID, int initialGroupID)
 {
     return InsertUser(user.userName,user.authID,user.firstName,user.lastName,user.email,user.affiliation,user.reason,
         user.xmlExtension,false, authenticationTypeID, initialGroupID);
 }
Example #9
0
        /* !------------------------------------------------------------------------------!
         *							CALLS FOR USERS
         * !------------------------------------------------------------------------------!
         */
        /// <summary>
        /// to add a user
        /// The previous call used to be
        /// public static void InsertUser(User user, string principalID, string authenticationType, string initialGroupID)
        /// principal ID is automatically generated by the principals table.
        /// </summary>
        public static int InsertUser(User user, string principalString, string authenticationType, int initialGroupID)
        {
            // The Add User stored procedure first inserts a user into the Agents table
            //& then Agent Hierarchy, with the specified parent group id
            // The AgentID is then used as the primary key in the Users table
            // Finally user is also entered into the principals table

            int userID = -1;

            DbConnection myConnection = FactoryDB.GetConnection();
            DbCommand myCommand = FactoryDB.CreateCommand("AddUser", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@userName", user.userName, DbType.String,256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@firstName",user.firstName, DbType.String, 256 ));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@lastName", user.lastName, DbType.String,256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@email", user.email, DbType.String,256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@affiliation", user.affiliation, DbType.String,256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@reason", user.reason, DbType.String,2048));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@XMLExtension", user.xmlExtension, DbType.AnsiString));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@lockUser",user.lockAccount,DbType.Boolean));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@principalString", principalString, DbType.String, 256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@authenType", authenticationType,DbType.AnsiString,256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@initialGroupID", initialGroupID,DbType.Int32));

            try
            {
                myConnection.Open();
                userID = Int32.Parse ( myCommand.ExecuteScalar().ToString ());
            }
            catch (DbException sex)
            {
                throw new Exception("SQLException thrown in inserting user", sex);
            }
            catch (Exception ex)
            {
                throw new Exception("Exception thrown in inserting user",ex);
            }
            finally
            {
                myConnection.Close();
            }

            // refresh A & A-H in memory cache
            AuthCache.AgentsSet = InternalAuthorizationDB.RetrieveAgents();
            AuthCache.AgentHierarchySet = InternalAuthorizationDB.RetrieveAgentHierarchy();

            return userID;
        }
Example #10
0
        /// <summary>
        /// to modify a user
        /// The previous call used to be
        /// public static void UpdateUser(User user, string principalID, string authenticationType)
        /// principalID was changed to principalString a while ago
        /// </summary>
        public static void UpdateUser(User user, string principalString, string authenticationType)
        {
            DbConnection myConnection = FactoryDB.GetConnection();
            DbCommand myCommand = FactoryDB.CreateCommand("ModifyUser", myConnection);
            myCommand.CommandType = CommandType.StoredProcedure;

            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand,"@userID", user.userID, DbType.Int32));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@userName", user.userName, DbType.String,256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@firstName", user.firstName, DbType.String, 256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@lastName", user.lastName, DbType.String, 256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@email", user.email, DbType.String, 256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@affiliation", user.affiliation, DbType.String, 256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@reason", user.reason, DbType.String, 2048));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@XMLExtension", user.xmlExtension, DbType.AnsiString));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@lockUser", user.lockAccount, DbType.Boolean));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@principalString", principalString, DbType.String, 256));
            myCommand.Parameters.Add(FactoryDB.CreateParameter(myCommand, "@authenType", authenticationType, DbType.AnsiString, 256));

            try
            {
                myConnection.Open();
                int i = myCommand.ExecuteNonQuery();
                if (i == 0)
                    throw new Exception ("No record exists exception");   //throws an exception if No records can be modified
            }
            catch (Exception ex)
            {
                throw new Exception("Exception thrown in updating user record",ex);
            }
            finally
            {
                myConnection.Close();
            }
        }
        //---------------------------------------------------------------------------------------//
        protected void Page_Load(object sender, EventArgs e)
        {
            lblResponse.Visible = false;

            if (!IsPostBack)
            {
                //
                // Populate textboxes with the user's information
                //
                AuthorizationWrapperClass wrapper = new AuthorizationWrapperClass();
                User sessionUser = new User();
                int userID = Convert.ToInt32(Session[Consts.STRSSN_UserID]);
                sessionUser = wrapper.GetUsersWrapper(new int[] { userID })[0];

                txtUsername.Enabled = false;
                txtUsername.Text = sessionUser.userName;
                txtFirstName.Text = sessionUser.firstName;
                txtLastName.Text = sessionUser.lastName;
                txtEmail.Text = sessionUser.email;
                txtNewPassword.Text = "";
                txtConfirmPassword.Text = "";

                // To list all the groups a user belongs to
                int[] groupIDs = wrapper.ListGroupsForAgentWrapper(userID);

                //since we already have the groups a user has access
                // if we use wrapper here, it will deny authentication
                Group[] gps = AdministrativeAPI.GetGroups(groupIDs);
                ArrayList nonRequestGroups = new ArrayList();
                ArrayList requestGroups = new ArrayList();

                foreach (Group g in gps)
                {
                    if (g.groupName.EndsWith("request"))
                        requestGroups.Add(g);
                    else
                        if (!g.groupName.Equals("NewUserGroup"))
                            nonRequestGroups.Add(g);
                }

                //
                // List Groups for which the user is a member
                //
                StringBuilder sb = new StringBuilder();
                if ((nonRequestGroups != null) && (nonRequestGroups.Count > 0))
                {
                    for (int i = 0; i < nonRequestGroups.Count; i++)
                    {
                        sb.Append(((Group)nonRequestGroups[i]).groupName);
                        if (i < nonRequestGroups.Count - 1)
                        {
                            sb.Append("<br />");
                        }
                    }
                }
                else
                {
                    sb.Append("No group");
                }
                lblGroups.Text = sb.ToString();

                //
                // List Groups for which the user has requested membership
                //
                sb = new StringBuilder();
                if ((requestGroups != null) && (requestGroups.Count > 0))
                {
                    for (int i = 0; i < requestGroups.Count; i++)
                    {
                        int origGroupID = AdministrativeAPI.GetAssociatedGroupID(((Group)requestGroups[i]).groupID);
                        string origGroupName = AdministrativeAPI.GetGroups(new int[] { origGroupID })[0].groupName;

                        sb.Append(origGroupName);
                        if (i < requestGroups.Count - 1)
                        {
                            sb.Append("<br />");
                        }
                    }
                }
                else
                {
                    sb.Append("No group");
                }
                lblRequestGroups.Text = sb.ToString();
            }
        }
Example #12
0
		private void DisplayUserInfo(User user)
		{
			ResetState();

			txtUsername.Text = user.userName;
			txtUsername.Enabled = false;
			txtFirstName.Text = user.firstName;
			txtLastName.Text = user.lastName;
			txtEmail.Text = user.email;

			/* Note if you change your drop down list options after launching the SB, 
					 * make sure your old affiliation options exist, or change them in the database.
					 * For e.g. if you change MIT Student to Student, make sure that the affiliation of 
					 * all the users is changed from "MIT Student" to "Student in the database.
					 * Otherwise the next step will throw an exception.*/
			if(ConfigurationSettings.AppSettings["useAffiliationDDL"].Equals("true"))
			{
				ddlAffiliation.Items .FindByText (user.affiliation).Selected = true;
			}
			else
			{
				txtAffiliation.Text = user.affiliation;
			}

			cbxLockAccount.Checked = user.lockAccount ;

			try
			{
				//Get explicit groups the user belongs to
				ArrayList nonRequestGroups = new ArrayList();
				ArrayList requestGroups = new ArrayList();
				int[] gpIDs = wrapper.ListGroupsForAgentWrapper (user.userID );
				ServiceBroker.Administration.Group[] gps=wrapper.GetGroupsWrapper(gpIDs);
				foreach(ServiceBroker.Administration.Group g in gps)
				{
					if (g.groupName.EndsWith("request"))
						requestGroups.Add(g);
					else 
						if(!g.groupName.Equals("NewUserGroup"))
						nonRequestGroups.Add(g);	
				}

				string groupsDisplay = "'"+user.userName + "'"+" is a member of the following groups:" + "<p>";
				if ((nonRequestGroups!=null)&& (nonRequestGroups.Count>0))
				{
					foreach (ServiceBroker.Administration.Group g in nonRequestGroups)
					{
						groupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;"+ g.groupName+ "<br>";
					}
				}
				else
				{
					groupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;no group <br>";
				}
					
				lblGroups.Text = groupsDisplay;

				string requestGroupsDisplay = "'"+user.userName + "'"+" has requested membership in the following groups:" + "<p>";
				if ((requestGroups!=null)&& (requestGroups.Count>0))
				{
					foreach (Administration.Group g in requestGroups)
					{
						int origGroupID = AdministrativeAPI.GetAssociatedGroupID(g.groupID);
						string origGroupName = AdministrativeAPI.GetGroups(new int[] {origGroupID})[0].groupName;
						requestGroupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;"+ origGroupName+ "<br>";
					}
				}
				else
				{
					requestGroupsDisplay += " &nbsp;&nbsp;-&nbsp;&nbsp;no group <br>";
				}
				lblRequestGroups.Text=requestGroupsDisplay;

				if (!Session["GroupName"].ToString().Equals(ServiceBroker.Administration.Group.SUPERUSER))
				{
					btnSaveChanges.Enabled=false;
					btnSaveChanges.CssClass="buttongray";
				}
			}

			catch (Exception ex)
			{
				string msg = "Exception: Trouble accessing page. "+ex.Message+". "+ex.GetBaseException();
				lblResponse.Text = Utilities.FormatErrorMessage(msg);
				lblResponse.Visible = true;
			}
		}
Example #13
0
		/* 
		 * Builds the Select Users List using a specified array of users. 
		 * This is used to return the results of a search
		 */
		private void BuildUserListBox(User[] users)
		{
			lbxSelectUser.Items .Clear ();
			
			foreach (User user in users) 
			{
				ListItem userItem = new ListItem();
				userItem.Text = user.lastName+", "+user.firstName+" - "+user.userName;
				userItem.Value = user.userID.ToString();
				lbxSelectUser.Items .Add(userItem);
			}
		}
Example #14
0
        /// <summary>
        /// Updates the data fields for the User specified by UserID; note that userID may not be changed.
        /// </summary>
        /// <param name="userID">The user ID whose data is being changed.</param>
        /// <param name="userName">A string to be used in administrative listings to identify the user on the Service Broker; If NULL, then the previous value will not be changed.</param>
        /// <param name="principalString">The string the user presents as his or her identifier when authenticating him or herself; if NULL, then the previous value will not be changed.</param>
        /// <param name="authenticationType">Determines the authentication module, native or supported external services, used to authenticate this user; if NULL, the previous value will not be changed.</param>
        /// <param name="firstName">The new contents of the firstName field; if NULL, then the previous value will not be changed.</param>
        /// <param name="lastName">The new contens of the lastName field; if NULL, then the previous value will not be changed.</param>
        /// <param name="email">The new contents of the email field; if NULL, then the previous value will not be changed.</param>
        /// <param name="affiliation">The new contents of the affiliation field; if NULL, then the previous value will not be changed.</param>
        /// <param name="reason">The text supplied by the user to explain his or her request for an account; If NULL, then the previous value will not be changed.</param>
        /// <param name="xmlExtension">The new contents of the xmlExtension field; if NULL, then the previous value will not be changed.</param>
        /// <param name="lockAccount">Indicates whether the user to be modified has locked accout.</param>
        /// <remarks>The user's registrationDate cannot be modified.
        /// A "No record exists exception" is thrown if no record exists in the database to be modified.
        /// </remarks>
        public static void ModifyUser(int userID,string userName, string principalString, string authenticationType, string firstName, string lastName, string email, string affiliation, string reason,string xmlExtension, bool lockAccount)
        {
            User user = new User ();
            user.userID = userID;
            user.userName = userName;
            user.firstName = firstName;
            user.lastName = lastName;
            user.reason = reason;
            user.email = email;
            user.affiliation = affiliation;
            user.xmlExtension = xmlExtension;
            user.lockAccount = lockAccount;

            try
            {
                // modified by charu on 5/22/04, since principal id should not be passed here. refer method for more information.
                InternalAdminDB.UpdateUser (user, principalString, authenticationType);
            }
            catch(Exception e)
            {
                throw;
            }
        }
Example #15
0
        ///*********************** USERS **************************///
        /// <summary>
        /// Registers a new user with the supplied information; makes the user a member of the group specified by initialGroupID.
        /// </summary>
        /// <param name="userName">A string to be used in administrative listings to identify the user on the Service Broker. Must be unique in a namespace shared with Group instance.</param>
        /// <param name="principalString">The string the user presents as his or her identifier to the mechanism used to authenticate the user.</param>
        /// <param name="authenticationType">Determines the authentication module, native or supported external services, used to authenticate this user.</param>
        /// <param name="firstName">The first name of the user.</param>
        /// <param name="lastName">The last name of the user.</param>
        /// <param name="email">The email address of the user.</param>
        /// <param name="affiliation">The affiliation of the user.</param>
        /// <param name="reason">The text supplied by the user to explain his or her request for an account.</param>
        /// <param name="xmlExtension">The XML extension string containing further information about the user.</param>
        /// <param name="initialGroupID">The Group to which this User will be initially assigned.</param>
        /// <param name="lockAccount">Indicates whether the user to be created will have his or her account locked.</param>
        /// <returns>The unique userID which identifies the user internally to the Service Broker.>0 if the user was unknown and was successfully registered;==-1 otherwise. In order for 
        /// this to happen, all the following must succeed:
        /// 1. userID must not be an element of the current User and Group namespace 
        /// 2. authenticationType must designate a supported type of authentication 
        /// 3. principalID must be unique within the specified authentication type 
        /// 4. xmlExtension must be successfully validated against the current User XML Extension schema specified by the SetUserXMLExtensionSchema method 
        /// 5. initialGroupID must designate a Group registered with the Service Broker</returns>
        public static int AddUser(string userName, string principalString, string authenticationType, string firstName, string lastName, string email, string affiliation,string reason, string xmlExtension, int initialGroupID, bool lockAccount)
        {
            User user = new User ();
            user.userName = userName;
            user.firstName = firstName;
            user.lastName = lastName;
            user.email = email;
            user.reason=reason;
            user.affiliation = affiliation;
            user.xmlExtension = xmlExtension;
            user.lockAccount = lockAccount;

            try
            {
                //Inserts agents too. See InternalDB method for details.

                // Add user to the database
                user.userID = InternalAdminDB.InsertUser (user, principalString, authenticationType, initialGroupID);
            }
            catch (Exception ex)
            {
                throw;
            }

            return user.userID;
        }