Example #1
0
    /// <summary>
    /// On item changed event.
    /// </summary>
    protected void gridMatrix_OnItemChanged(object sender, int roleId, int permissionId, bool allow)
    {
        if (!CheckPermissions("CMS.ProjectManagement", PERMISSION_MANAGE))
        {
            return;
        }

        // Delete permission hash tables
        ProjectInfoProvider.ClearProjectPermissionTable(ProjectID, CMSContext.CurrentUser);

        if (allow)
        {
            ProjectRolePermissionInfoProvider.AddRelationship(ProjectID, roleId, permissionId);
        }
        else
        {
            ProjectRolePermissionInfoProvider.RemoveRelationship(ProjectID, roleId, permissionId);
        }
    }
Example #2
0
    public void RaisePostBackEvent(string eventArgument)
    {
        if (!CheckPermissions("CMS.ProjectManagement", PERMISSION_MANAGE))
        {
            return;
        }

        string[] args = eventArgument.Split(';');
        if (args.Length == 2)
        {
            // Get info on currently selected item
            int permission = ValidationHelper.GetInteger(args[0], 0);
            int access     = ValidationHelper.GetInteger(args[1], 0);

            if (project != null)
            {
                // Update project permission access information
                switch (permission)
                {
                case 0:
                    // Set 'AllowRead' permission to specified access
                    project.AllowRead = (SecurityAccessEnum)access;
                    break;

                case 1:
                    // Set 'AttachCreate' permission to specified access
                    project.AllowCreate = ((SecurityAccessEnum)access);
                    break;

                case 2:
                    // Set 'AllowModify' permission to specified access
                    project.AllowModify = (SecurityAccessEnum)access;
                    break;

                case 3:
                    // Set 'AllowDelete' permission to specified access
                    project.AllowDelete = ((SecurityAccessEnum)access);
                    break;

                default:
                    break;
                }

                // Delete permission hash tables
                ProjectInfoProvider.ClearProjectPermissionTable(ProjectID, CMSContext.CurrentUser);

                // Use try/catch due to license check
                try
                {
                    // Save changes to the project
                    ProjectInfoProvider.SetProjectInfo(project);
                }
                catch (Exception ex)
                {
                    lblError.Visible = true;
                    lblError.Text    = ex.Message;
                }

                createMatrix = true;
            }
        }
    }