Exemplo n.º 1
0
        protected void btnSave_Click(object sender, EventArgs e)
        {
            Page.Validate();
            if (!this.Page.IsValid)
            {
                return;
            }

            if (RightId > 0)
            {
                CustomTableRow row = Mediachase.Ibn.Data.Services.Security.GetRightItem(ClassName, RightId);
                row["FriendlyName"] = txtFriendlyName.Text;
                row.Update();
            }
            else
            {
                Mediachase.Ibn.Data.Services.Security.RegisterRight(ClassName, txtName.Text, txtFriendlyName.Text);
            }


            // Closing window
            if (RefreshButton == String.Empty)
            {
                CHelper.CloseItAndRefresh(Response);
            }
            else              // Dialog Mode
            {
                CHelper.CloseItAndRefresh(Response, RefreshButton);
            }
        }
Exemplo n.º 2
0
 private void BindData()
 {
     if (RightId > 0)
     {
         CustomTableRow row = Mediachase.Ibn.Data.Services.Security.GetRightItem(ClassName, RightId);
         if (row != null)
         {
             txtName.Text         = row["RightName"].ToString();
             txtName.ReadOnly     = true;
             txtFriendlyName.Text = row["FriendlyName"].ToString();
         }
     }
 }
Exemplo n.º 3
0
        private void GenerateStructure()
        {
            CustomTableRow[] classRights = CustomTableRow.List(SqlContext.Current.Database.Tables[Mediachase.Ibn.Data.Services.Security.BaseRightsTableName],
                                                               FilterElement.EqualElement("ClassOnly", 1));

            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(ClassName))
            {
                // Check for Class Right (ex. Create)
                bool   isClassRight = false;
                string rightUid     = right.BaseRightUid.ToString();
                foreach (CustomTableRow r in classRights)
                {
                    if (r["BaseRightUid"].ToString() == rightUid)
                    {
                        isClassRight = true;
                        break;
                    }
                }
                if (isClassRight)
                {
                    continue;
                }

                // adding rows
                HtmlTableRow tr = new HtmlTableRow();

                HtmlTableCell td   = new HtmlTableCell();
                CheckControl  ctrl = (CheckControl)LoadControl("~/Apps/Common/Design/CheckControl.ascx");
                ctrl.Text = CHelper.GetResFileString(right.FriendlyName);

                td.Controls.Add(ctrl);
                tr.Cells.Add(td);
                tblRights.Rows.Add(tr);

                checkControls.Add(ctrl);
                rights.Add(right.RightName);
            }
        }
Exemplo n.º 4
0
 public Report(CustomTableRow row, MetaObjectOptions options)
     : base(Report.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 5
0
 public CalendarFolderLink(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarFolderLink.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 6
0
 public TimeTrackingEntry(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 7
0
 public Principal(CustomTableRow row, MetaObjectOptions options)
     : base(Principal.GetAssignedMetaClass(), row, options)
 {
 }
 public TimeTrackingBlockTypeInstance(CustomTableRow row)
     : base(TimeTrackingBlockTypeInstance.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 9
0
 public ListInfo(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 10
0
 public TimeTrackingBlock(CustomTableRow row)
     : base(TimeTrackingBlock.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 11
0
 public Report(CustomTableRow row, MetaObjectOptions options)
     : base(Report.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 12
0
 public Report(CustomTableRow row)
     : base(Report.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 13
0
 public TimeTrackingEntry(CustomTableRow row)
     : base(TimeTrackingEntry.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 14
0
 public CalendarEvent(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarEvent.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 15
0
 public CalendarEventLink(CustomTableRow row)
     : base(CalendarEventLink.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 16
0
 public ListInfo(CustomTableRow row)
     : base(ListInfo.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 17
0
 public Principal(CustomTableRow row)
     : base(Principal.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 18
0
 public CalendarFolder(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarFolder.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 19
0
 public Principal(CustomTableRow row, MetaObjectOptions options)
     : base(Principal.GetAssignedMetaClass(), row, options)
 {
 }
 public TimeTrackingBlockTypeInstance(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 21
0
 public Principal(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 22
0
 public TimeTrackingEntry(CustomTableRow row)
     : base(TimeTrackingEntry.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 23
0
 public ListInfo(CustomTableRow row)
     : base(ListInfo.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 24
0
 public ListPublication(CustomTableRow row, MetaObjectOptions options)
     : base(ListPublication.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 25
0
        private void GenerateStructure()
        {
            if (MainGrid.Columns.Count > 0)
            {
                MainGrid.Columns.Clear();
            }

            BoundField field = new BoundField();

            field.DataField                   = roleColumn;
            field.HeaderText                  = GetGlobalResourceObject("IbnFramework.Security", "Role").ToString();
            field.HeaderStyle.CssClass        = "ibn-vh";
            field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            field.ItemStyle.HorizontalAlign   = HorizontalAlign.Left;
            MainGrid.Columns.Add(field);

            int rightsCounter = 0;

            CustomTableRow[] classRights = CustomTableRow.List(SqlContext.Current.Database.Tables[Mediachase.Ibn.Data.Services.Security.BaseRightsTableName],
                                                               FilterElement.EqualElement("ClassOnly", 1));

            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(mc.Name))
            {
                // Check for Class Right (ex. Create)
                bool   isClassRight = false;
                string rightUid     = right.BaseRightUid.ToString();
                foreach (CustomTableRow r in classRights)
                {
                    if (r["BaseRightUid"].ToString() == rightUid)
                    {
                        isClassRight = true;
                        break;
                    }
                }
                if (isClassRight)
                {
                    continue;
                }

                rightsCounter++;
                field                      = new BoundField();
                field.DataField            = right.RightName;
                field.HeaderText           = CHelper.GetResFileString(right.FriendlyName);
                field.HeaderStyle.CssClass = "thCenter";
                field.HtmlEncode           = false;
                MainGrid.Columns.Add(field);
            }

            for (int i = 1; i <= rightsCounter; i++)
            {
                MainGrid.Columns[i].HeaderStyle.Width = Unit.Percentage(percentsForRights / rightsCounter);
            }

            // Edit
            field                   = new BoundField();
            field.DataField         = editColumn;
            field.HeaderText        = String.Empty;
            field.HtmlEncode        = false;
            field.HeaderStyle.Width = Unit.Pixel(25);
            field.ItemStyle.Width   = Unit.Pixel(25);
            MainGrid.Columns.Add(field);

            // Reset
            ButtonField btn = new ButtonField();

            btn.ButtonType = ButtonType.Link;
            btn.Text       = String.Format(CultureInfo.InvariantCulture,
                                           "<img src='{0}' width='16' height='16' border='0' title='{1}' />",
                                           ResolveUrl("~/Images/IbnFramework/Undo.png"),
                                           GetGlobalResourceObject("IbnFramework.Security", "ResetToBase").ToString());
            btn.HeaderStyle.Width = Unit.Pixel(25);
            btn.ItemStyle.Width   = Unit.Pixel(25);
            btn.CommandName       = "Reset";
            MainGrid.Columns.Add(btn);

            string[] dataKeyNames = { idColumn };
            MainGrid.DataKeyNames = dataKeyNames;
        }
Exemplo n.º 26
0
 public Report(CustomTableRow row)
     : base(Report.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 27
0
 public Folder(CustomTableRow row)
     : base(Folder.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 28
0
 public Report(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 29
0
 public Folder(CustomTableRow row, MetaObjectOptions options)
     : base(Folder.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 30
0
 public CalendarEvent(CustomTableRow row)
     : base(CalendarEvent.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 31
0
 public Folder(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 32
0
 public CalendarEvent(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 33
0
 public TimeTrackingBlockType(CustomTableRow row)
     : base(TimeTrackingBlockType.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 34
0
 public ListInfo(CustomTableRow row, MetaObjectOptions options)
     : base(ListInfo.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 35
0
 public TimeTrackingBlockType(CustomTableRow row, MetaObjectOptions options)
     : base(TimeTrackingBlockType.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 36
0
 public CalendarFolder(CustomTableRow row)
     : base(CalendarFolder.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 37
0
 public TimeTrackingBlockType(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 38
0
 public CalendarFolder(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 39
0
        private void GenerateStructure()
        {
            if (MainGrid.Columns.Count > 0)
            {
                MainGrid.Columns.Clear();
            }

            BoundField field = new BoundField();

            field.DataField  = roleColumn;
            field.HeaderText = GetGlobalResourceObject("IbnFramework.Security", "Role").ToString();
            field.HeaderStyle.HorizontalAlign = HorizontalAlign.Left;
            field.ItemStyle.HorizontalAlign   = HorizontalAlign.Left;
            field.HeaderStyle.CssClass        = "ibn-vh";
            MainGrid.Columns.Add(field);

            int rightsCounter = 0;

            this.Visible = true;

            CustomTableRow[] classRights = CustomTableRow.List(SqlContext.Current.Database.Tables[Mediachase.Ibn.Data.Services.Security.BaseRightsTableName],
                                                               FilterElement.EqualElement("ClassOnly", 1));

            try
            {
                foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(mc.Name))
                {
                    // Check for Class Right (ex. Create)
                    bool   isClassRight = false;
                    string rightUid     = right.BaseRightUid.ToString();
                    foreach (CustomTableRow r in classRights)
                    {
                        if (r["BaseRightUid"].ToString() == rightUid)
                        {
                            isClassRight = true;
                            break;
                        }
                    }
                    if (isClassRight)
                    {
                        continue;
                    }

                    rightsCounter++;
                    field                      = new BoundField();
                    field.DataField            = right.RightName;
                    field.HeaderText           = CHelper.GetResFileString(right.FriendlyName);
                    field.HeaderStyle.CssClass = "thCenter";
                    field.HtmlEncode           = false;
                    MainGrid.Columns.Add(field);
                }
            }
            catch
            {
                this.Visible = false;
                return;
            }

            for (int i = 1; i <= rightsCounter; i++)
            {
                MainGrid.Columns[i].HeaderStyle.Width = Unit.Percentage(percentsForRights / rightsCounter);
            }

            // Edit
            field                   = new BoundField();
            field.DataField         = editColumn;
            field.HeaderText        = String.Empty;
            field.HtmlEncode        = false;
            field.HeaderStyle.Width = Unit.Pixel(25);
            field.ItemStyle.Width   = Unit.Pixel(25);
            MainGrid.Columns.Add(field);

            string[] dataKeyNames = { idColumn };
            MainGrid.DataKeyNames = dataKeyNames;
        }
 public TimeTrackingBlockTypeInstance(CustomTableRow row, MetaObjectOptions options)
     : base(TimeTrackingBlockTypeInstance.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 41
0
        private void BindGrid()
        {
            if (!this.Visible)
            {
                return;
            }

            // DataTable structure
            DataTable dt = new DataTable();

            dt.Locale = CultureInfo.InvariantCulture;
            dt.Columns.Add(idColumn, typeof(string));
            dt.Columns.Add(roleColumn, typeof(string));
            dt.Columns.Add(classColumn, typeof(string));

            CustomTableRow[] classRights = CustomTableRow.List(SqlContext.Current.Database.Tables[Mediachase.Ibn.Data.Services.Security.BaseRightsTableName],
                                                               FilterElement.EqualElement("ClassOnly", 1));

            foreach (SecurityRight right in Mediachase.Ibn.Data.Services.Security.GetMetaClassRights(mc.Name))
            {
                // Check for Class Right (ex. Create)
                bool   isClassRight = false;
                string rightUid     = right.BaseRightUid.ToString();
                foreach (CustomTableRow r in classRights)
                {
                    if (r["BaseRightUid"].ToString() == rightUid)
                    {
                        isClassRight = true;
                        break;
                    }
                }
                if (isClassRight)
                {
                    continue;
                }

                dt.Columns.Add(right.RightName, typeof(string));
            }
            dt.Columns.Add(editColumn, typeof(string));

            // Fill data
            DataRow dr;

            foreach (MetaObject mo in Mediachase.Ibn.Data.Services.RoleManager.GetObjectRoleItems(mc.Name))
            {
                string roleName = mo.Properties["RoleName"].Value.ToString();

                dr             = dt.NewRow();
                dr[idColumn]   = mo.PrimaryKeyId;
                dr[roleColumn] = CHelper.GetResFileString(mo.Properties["FriendlyName"].Value.ToString());
                if (mo.Properties["ClassName"].Value != null)
                {
                    string className = (string)mo.Properties["ClassName"].Value;
                    if (className.Contains("::"))
                    {
                        string[] s = new string[] { "::" };
                        className = className.Split(s, StringSplitOptions.None)[0];
                    }
                    dr[classColumn] = className;
                    dr[roleColumn] += String.Format(CultureInfo.InvariantCulture,
                                                    " ({0})",
                                                    CHelper.GetResFileString(MetaDataWrapper.GetMetaClassByName(className).PluralName));
                }

                for (int i = 1; i < MainGrid.Columns.Count - 1; i++)
                {
                    BoundField rightsField = MainGrid.Columns[i] as BoundField;
                    if (rightsField != null)
                    {
                        string fieldName = rightsField.DataField;
                        dr[fieldName] = CHelper.GetPermissionImage((int)mo.Properties[fieldName].Value);
                    }
                }

                string url = String.Format(CultureInfo.InvariantCulture,
                                           "javascript:ShowWizard(&quot;{5}?ClassName={0}&btn={1}&Role={2}&quot;, {3}, {4});",
                                           mc.Name,
                                           Page.ClientScript.GetPostBackEventReference(RefreshButton, ""),
                                           roleName,
                                           dialogWidth, dialogHeight,
                                           ResolveUrl("~/Apps/Security/Pages/Admin/ObjectRoleEdit.aspx"));
                dr[editColumn] = String.Format(CultureInfo.InvariantCulture,
                                               "<a href=\"{0}\"><img src=\"{1}\" title=\"{2}\" width=\"16\" height=\"16\" border=\"0\" /></a>",
                                               url,
                                               ResolveUrl("~/Images/IbnFramework/edit.gif"),
                                               GetGlobalResourceObject("IbnFramework.GlobalMetaInfo", "Edit").ToString());

                dt.Rows.Add(dr);
            }

            MainGrid.DataSource = dt;
            MainGrid.DataBind();
        }
Exemplo n.º 42
0
 public Principal(CustomTableRow row)
     : base(Principal.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 43
0
 public CalendarFolder(CustomTableRow row)
     : base(CalendarFolder.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 44
0
 public Principal(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 45
0
 public CalendarEventRecurrence(CustomTableRow row)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 46
0
 public TimeTrackingEntry(CustomTableRow row, MetaObjectOptions options)
     : base(TimeTrackingEntry.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 47
0
 public CalendarEventRecurrence(CustomTableRow row, MetaObjectOptions options)
     : base(CalendarEventRecurrence.GetAssignedMetaClass(), row, options)
 {
 }
Exemplo n.º 48
0
 public ListPublication(CustomTableRow row)
     : base(ListPublication.GetAssignedMetaClass(), row)
 {
 }
Exemplo n.º 49
0
 public CalendarEventRecurrence(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 50
0
 public ListPublication(MetaClass metaType, CustomTableRow row, MetaObjectOptions options)
     : base(metaType, row, options)
 {
 }
Exemplo n.º 51
0
 public ListPublication(CustomTableRow row)
     : base(ListPublication.GetAssignedMetaClass(), row)
 {
 }