Exemplo n.º 1
0
        /// <summary>
        /// Sets security according to permissions
        /// </summary>
        private void SetFieldSecurity()
        {
            //check permission objects
            if (User.Identity.IsAuthenticated)
            {
                //enable editing of description if user has permission or in admin role
                if ((UserManager.IsInRole(ProjectId, Globals.ProjectAdminRole) || UserManager.HasPermission(ProjectId, Common.Permission.EditIssueDescription.ToString())) && !DescriptionHtmlEditor.Visible)
                {
                    EditDescription.Visible = true;
                }

                if ((UserManager.IsInRole(ProjectId, Globals.ProjectAdminRole) || UserManager.HasPermission(ProjectId, Common.Permission.EditIssueTitle.ToString())) && !TitleTextBox.Visible)
                {
                    EditTitle.Visible = true;
                }

                //edit issue permission check
                if (!UserManager.HasPermission(ProjectId, Common.Permission.EditIssue.ToString()))
                {
                    LockFields();
                }

                //assign issue permission check
                if (!UserManager.HasPermission(ProjectId, Common.Permission.AssignIssue.ToString()))
                {
                    DropAssignedTo.Enabled = false;
                }

                //delete issue
                lnkDelete.Visible = UserManager.HasPermission(ProjectId, Common.Permission.DeleteIssue.ToString());

                //security check: assign issue
                if (!UserManager.HasPermission(ProjectId, Common.Permission.AssignIssue.ToString()))
                {
                    DropAssignedTo.Enabled = false;
                }

                if (!UserManager.HasPermission(ProjectId, Common.Permission.ChangeIssueStatus.ToString()))
                {
                    DropStatus.Enabled = false;
                }

                //remove closed status' if user does not have access
                if (!UserManager.HasPermission(ProjectId, Common.Permission.CloseIssue.ToString()))
                {
                    var stat   = (DropDownList)DropStatus.FindControl("dropStatus");
                    var status = StatusManager.GetByProjectId(ProjectId).FindAll(st => st.IsClosedState);

                    foreach (var s in status)
                    {
                        stat.Items.Remove(stat.Items.FindByValue(s.Id.ToString()));
                    }
                }
            }
            else
            {
                LockFields();
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Binds the options.
        /// </summary>
        private void BindOptions()
        {
            List <ITUser> users = UserManager.GetUsersByProjectId(ProjectId, true);

            //Get Type
            DropIssueType.DataSource = IssueTypeManager.GetByProjectId(ProjectId);
            DropIssueType.DataBind();

            //Get Priority
            DropPriority.DataSource = PriorityManager.GetByProjectId(ProjectId);
            DropPriority.DataBind();

            //Get Resolutions
            DropResolution.DataSource = ResolutionManager.GetByProjectId(ProjectId);
            DropResolution.DataBind();

            //Get categories
            var categories = new CategoryTree();

            DropCategory.DataSource = categories.GetCategoryTreeByProjectId(ProjectId);
            DropCategory.DataBind();

            //Get milestones
            DropMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId);
            DropMilestone.DataBind();

            DropAffectedMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId);
            DropAffectedMilestone.DataBind();

            //Get Users
            DropAssignedTo.DataSource = users;
            DropAssignedTo.DataBind();

            DropOwned.DataSource = users;
            DropOwned.DataBind();

            DropStatus.DataSource = StatusManager.GetByProjectId(ProjectId);
            DropStatus.DataBind();

            lblDateCreated.Text  = DateTime.Now.ToString("f");
            lblLastModified.Text = DateTime.Now.ToString("f");

            if (!User.Identity.IsAuthenticated)
            {
                return;
            }

            lblReporter.Text       = Security.GetDisplayName();
            lblLastUpdateUser.Text = Security.GetDisplayName();
        }
Exemplo n.º 3
0
        /// <summary>
        /// Binds the options.
        /// </summary>
        private void BindOptions()
        {
            List <ITUser> users = UserManager.GetUsersByProjectId(ProjectId, true);

            //Get Type
            DropIssueType.DataSource = IssueTypeManager.GetByProjectId(ProjectId);
            DropIssueType.DataBind();

            //Get Priority
            DropPriority.DataSource = PriorityManager.GetByProjectId(ProjectId);
            DropPriority.DataBind();

            //Get Resolutions
            DropResolution.DataSource = ResolutionManager.GetByProjectId(ProjectId);
            DropResolution.DataBind();

            //Get categories
            var categories = new CategoryTree();

            DropCategory.DataSource = categories.GetCategoryTreeByProjectId(ProjectId);
            DropCategory.DataBind();

            //Get milestones
            DropMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId, false);
            DropMilestone.DataBind();

            DropAffectedMilestone.DataSource = MilestoneManager.GetByProjectId(ProjectId);
            DropAffectedMilestone.DataBind();

            //Get Users
            DropAssignedTo.DataSource = users;
            DropAssignedTo.DataBind();

            DropOwned.DataSource = users;
            DropOwned.DataBind();
            DropOwned.SelectedValue = User.Identity.Name;

            DropStatus.DataSource = StatusManager.GetByProjectId(ProjectId);
            DropStatus.DataBind();
        }
Exemplo n.º 4
0
        /// <summary>
        /// Sets icon indicating an action that would happen if the dragged fruiton was dropped.
        /// </summary>
        /// <param name="status">drop status</param>
        public void SetDropStatus(DropStatus status)
        {
            Color statusColor = Color.white;

            switch (status)
            {
            case DropStatus.Delete:
            case DropStatus.Nothing:
                statusColor = Color.red;
                break;

            case DropStatus.Ok:
                statusColor = Color.green;
                break;

            case DropStatus.Swap:
                statusColor = new Color(0.3f, 0.3f, 1);
                break;
            }
            dropStatusIcon.sprite = dropStatusSprites[(int)status];
            dropStatusIcon.color  = statusColor;
        }
 //
 private void UpdateDropSuccess(int i, DropStatus dropStatus)
 {
     try
     {
         MarkMachineDropStatus(false, _finalDrop, Convert.ToInt32(dropStatus), GetSelectedInstallations[i], NOTSET, NOTSET.ToString(), NOTSET, NOTSET);
         SUCESS_BAR_POSITIONS += (string.IsNullOrEmpty(SUCESS_BAR_POSITIONS) ? "" : ", ") + GetSelectedBarPositions[i];
         SUCESS_INSTALLAITONS += (string.IsNullOrEmpty(SUCESS_INSTALLAITONS) ? "" : ", ") + GetSelectedInstallations[i].ToString();
     }
     catch (Exception ex) { LogError("UpdateDropSuccess", ex); }
 }