示例#1
0
        void Setup(
            string groupName,
            bool editable)
        {
            AccessControlList acl;
            AclItem           aclItem;

            Text = "Users in the Group: " + groupName;

            Editable = editable;
            PermissionsList.Editable = editable;

            Uo = UserObjectDao.ReadHeader(UserObjectType.UserGroup, "Mobius", "", groupName);
            if (Uo == null)
            {
                Uo              = new UserObject();
                Uo.Type         = UserObjectType.UserGroup;
                Uo.Name         = groupName;
                Uo.Owner        = "Mobius";
                Uo.ParentFolder = "";                 // no parent folder
                acl             = new AccessControlList();
                acl.MakePublic(SS.I.UserName);        // write to creator, read to others
            }

            acl = AccessControlList.Deserialize(Uo.ACL);             // content is the list of users
            PermissionsList.Setup(acl);
            return;
        }
示例#2
0
        private void MakePrivate_Click(object sender, EventArgs e)
        {
            AccessControlList acl = new AccessControlList();

            acl.MakePrivate(Uo.Owner);
            PermissionsList.Setup(acl);
        }
示例#3
0
        void Setup(UserObject uo)
        {
            Text = "Permissions for " + uo.Name;

            Uo = uo;

            if (UserObjectUtil.UserHasWriteAccess(uo))
            {
                Editable = true;
                PermissionsList.Editable = true;
                MakePublic.Enabled       = MakePrivate.Enabled = AdvancedButton.Enabled = true;
            }

            else
            {
                Editable = false;
                PermissionsList.Editable = false;
                MakePublic.Enabled       = MakePrivate.Enabled = AdvancedButton.Enabled = false;
            }

            AccessControlList acl = AccessControlList.Deserialize(uo);

            PermissionsList.Setup(acl);
            return;
        }
示例#4
0
/// <summary>
/// Update the list
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void OkButton_Click(object sender, EventArgs e)
        {
            if (!Editable)
            {
                DialogResult = DialogResult.OK;
                return;
            }

            AccessControlList acl = PermissionsList.GetAcl();

            acl.AddReadWriteUserItem(SS.I.UserName); // be sure current user is included

            Uo.ACL         = acl.Serialize();        // just an ACL, no content
            Uo.AccessLevel = UserObjectAccess.ACL;
            UserObjectDao.Write(Uo, Uo.Id);

            UserGroups.UpdateInMemoryCollection(Uo.Name, acl);
            DialogResult = DialogResult.OK;
        }
示例#5
0
/// <summary>
/// Save the changes
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>

        private void OkButton_Click(object sender, EventArgs e)
        {
            if (!Editable)
            {
                DialogResult = DialogResult.OK;
                return;
            }

            AccessControlList acl = PermissionsList.GetAcl();

            acl.AddReadWriteUserItem(SS.I.UserName);             // be sure owner is included

            if (acl.IsPrivate)
            {
                Uo.AccessLevel = UserObjectAccess.Private;
                Uo.ACL         = "";
            }
            else if (acl.IsPublic)
            {
                Uo.AccessLevel = UserObjectAccess.Public;
                Uo.ACL         = "";
            }
            else
            {
                Uo.AccessLevel = UserObjectAccess.ACL;
                Uo.ACL         = acl.Serialize();
            }

            if (Uo.Id > 0)             // update header if object exists already
            {
                UserObjectDao.UpdateHeader(Uo, false, true);
            }

            DialogResult = DialogResult.OK;
            return;
        }