Exemple #1
0
        protected void ShowSecondaryAdminRights(string GroupID)
        {
            long RightsValue = web.GetUserGroupRights(SecondaryAdmin, GroupID);

            UserGroupAdminRights UsersGroupRights = new UserGroupAdminRights(RightsValue);

            NoOfiFoldersList.Items[0].Selected = UsersGroupRights.iFolderLimitAllowed;

            DiskQuotaRightsList.Items[0].Selected = UsersGroupRights.DiskQuotaAllowed;

            FileSizeRightsList.Items[0].Selected = UsersGroupRights.FileSizeAllowed;

            SyncIntervalRightsList.Items[0].Selected = UsersGroupRights.SyncIntervalAllowed;

            FileListRightsList.Items[0].Selected = UsersGroupRights.AddToExcludePolicyAllowed;

            SharingRightsList.Items[0].Selected = UsersGroupRights.ChangeSharingAllowed;

            EncryptionRightsList.Items[0].Selected = UsersGroupRights.ChangeEncryptionAllowed;

            ProvisioningRightsList.Items[0].Selected = UsersGroupRights.ProvisioningAllowed;
            ProvisioningRightsList.Items[1].Selected = UsersGroupRights.EnableDisableUserAllowed;

            iFolderRightsList.Items[0].Selected = UsersGroupRights.OwnOrphaniFolderAllowed;
            iFolderRightsList.Items[1].Selected = UsersGroupRights.EnableDisableiFolderAllowed;
            iFolderRightsList.Items[2].Selected = UsersGroupRights.ModifyMemberRightAllowed;
            iFolderRightsList.Items[3].Selected = UsersGroupRights.DeleteiFolderAllowed;
        }
Exemple #2
0
        /// <summary>
        /// Gets whether the user is provisioned or not.
        /// </summary>
        /// <param name="provisioned value"></param>
        /// <returns>True if the user is allowed to be checked.</returns>
        protected bool IsUserProvisioned(object isProvisioned, object preference)
        {
            // If user is provisioned , then enabled field should be false
            bool retval = false;

            retval = (isProvisioned as string) == null ? true : false;
            if (retval == true)
            {
                int val = 0;

                string pref = preference as string;
                val = Convert.ToInt32(pref);
                if (val == 0 || val == 0xffff)
                {
                    return(true);
                }

                UserGroupAdminRights rights = new UserGroupAdminRights(val);
                if (rights.ProvisioningAllowed)
                {
                    retval = true;
                }
                else
                {
                    retval = false;
                }
            }

            return(retval);
            //return (isProvisioned as string ) == null ? true : false ;
        }
Exemple #3
0
        /// <summary>
        /// Creates a stateful list of file type filters.
        /// </summary>
        /// <param name="policy">iFolder policy object</param>
        /// <returns>A hashtable containing the file type filters.</returns>
        private Hashtable CreateFileTypeSource(iFolderPolicy policy)
        {
            // Keep the state in a hashtable.
            Hashtable            ht      = new Hashtable();
            UserGroupAdminRights uRights = new UserGroupAdminRights(policy.AdminGroupRights);

            foreach (string s in policy.FileTypesExcludesEffective)
            {
                ht[s] = new FileTypeInfo(
                    s,
                    Utils.ConvertFromRegEx(s),
                    IsAllowed(policy.FileTypesIncludesEffective, s),
                    false);
            }

            foreach (string s in policy.FileTypesExcludes)
            {
                ht[s] = new FileTypeInfo(
                    s,
                    Utils.ConvertFromRegEx(s),
                    false,
                    uRights.AddToExcludePolicyAllowed);
            }

            return(ht);
        }
Exemple #4
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL          = web.Url;
            remoteweb                 = new iFolderAdmin();
            remoteweb.PreAuthenticate = true;
            remoteweb.Credentials     = web.Credentials;
            remoteweb.Url             = web.Url;
            reachable                 = true;

            // localization
            rm = Application["RM"] as ResourceManager;

            string userID = Session["UserID"] as String;

            grpAccessPolicy = web.GetUserGroupRights(userID, null);
            uRights         = new UserGroupAdminRights(grpAccessPolicy);
            if (!IsPostBack)
            {
                // Initialize the localized fields.
                iFolderList.Columns[iFolderTypeColumn].HeaderText  = GetString("TYPE");
                iFolderList.Columns[iFolderNameColumn].HeaderText  = GetString("NAME");
                iFolderList.Columns[iFolderOwnerColumn].HeaderText = GetString("OWNER");

                //DeleteiFolderButton.Text = GetString( "DELETE" );
                DisableiFolderButton.Text = GetString("DISABLE");
                EnableiFolderButton.Text  = GetString("ENABLE");
                DeleteiFolderButton.Text  = GetString("DELETE");
                //CreateiFolderButton.Text = GetString( "CREATE" );

                AlliFoldersLink.Text    = GetString("ALL");
                OwnediFoldersLink.Text  = GetString("OWNED");
                SharediFoldersLink.Text = GetString("SHARED");

                // Initialize state variables.
                CurrentiFolderOffset        = 0;
                TotaliFolders               = 0;
                AlliFoldersCheckBox.Checked = false;
                CheckediFolders             = new Hashtable();

                // Set the active ifolder tab.
                ActiveiFolderTab = ListDisplayType.All;

                //CreateiFolderButton.Enabled = GetCreateButtonStatus();
            }

            // Set the active ifolder display tab.
            SetActiveiFolderListTab(ActiveiFolderTab);
            DeleteiFolderButton.Enabled = uRights.DeleteiFolderAllowed;

            if (uRights.EnableDisableiFolderAllowed == false)
            {
                AlliFoldersCheckBox.Enabled = false;
                //iFolderListCheckBox.Enabled = false;
            }
        }
Exemple #5
0
        /// <summary>
        /// Returns the checked state for the specified member.
        /// </summary>
        /// <param name="id">ID of the ifolder</param>
        /// <returns>True if ifolder is checked.</returns>
        protected bool IsiFolderEnabled(Object pref)
        {
            int preference = (int)pref;

            if (preference == -1)
            {
                preference = 0xffff;
            }
            UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);

            return(rights.EnableDisableiFolderAllowed);
        }
Exemple #6
0
        /// <summary>
        /// event handler that gets called when the save user button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnSaveButton_Click(object source, EventArgs e)
        {
            Hashtable ServerProvisioningNamesNew = new Hashtable();

            foreach (string userid in ServerProvisioningNames.Keys)
            {
                int preference = GetRightsForUser(userid);
                if (preference == -1)
                {
                    preference = 0xffff;
                }
                UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                if (rights.ProvisioningAllowed)
                {
                    ServerProvisioningNamesNew.Add(userid, ServerProvisioningNames[userid]);
                }
            }
            ServerProvisioningNames = ServerProvisioningNamesNew;
            String [] ServerNames = new string [ServerProvisioningNames.Keys.Count];
            String [] UserIDs     = new string [ServerProvisioningNames.Keys.Count];
            ServerProvisioningNames.Keys.CopyTo(UserIDs, 0);
            ServerProvisioningNames.Values.CopyTo(ServerNames, 0);

            iFolderAdmin remoteweb = new iFolderAdmin();

            iFolderServer[] list = web.GetServers();

            foreach (iFolderServer server in list)
            {
                if (server.IsMaster)
                {
                    remoteweb.PreAuthenticate = true;
                    remoteweb.Credentials     = web.Credentials;
                    remoteweb.Url             = server.PublicUrl + "/iFolderAdmin.asmx";
                    remoteweb.GetAuthenticatedUser();
                    remoteweb.ProvisionUsersToServers(ServerNames, UserIDs);
                    break;
                }
            }

            /// clear the hastable
            ServerProvisioningNames.Clear();

            SaveButton.Enabled = false;

            /// Display the page with new values
            Accounts.DataSource = CreateDataSource();
            Accounts.DataBind();
            AllUsersCheckBox.Checked = false;
            SetPageButtonState();
            GetSelectedItem();
        }
Exemple #7
0
        /// <summary>
        /// Returns the checked state for the specified member.
        /// </summary>
        /// <param name="id">ID of the ifolder</param>
        /// <returns>True if ifolder is checked.</returns>
        protected bool IsiFolderEnabled(Object pref)
        {
            int preference = (int)pref;

            if (preference == -1)
            {
                preference = 0xffff;
            }
            UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);

            return(rights.EnableDisableiFolderAllowed);
            //      return CheckediFolders.ContainsKey( id ) ? true : false;
        }
Exemple #8
0
        /// <summary>
        /// Sets the ifolder synchronization status on all selected ifolders.
        /// </summary>
        /// <param name="syncStatus">If true then all selected ifolders will be enabled.</param>
        private void SetSelectediFolderStatus(bool syncStatus)
        {
            foreach (string ifolderID in CheckediFolders.Keys)
            {
                /// Check for rights...
                int preference = GetRightsForiFolder(ifolderID);
                if (preference == -1)
                {
                    preference = 0xffff;
                }
                UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                if (!rights.EnableDisableiFolderAllowed)
                {
                    continue;
                }
                // Don't set the status if already set.
                if (CheckediFolders[ifolderID] as string != syncStatus.ToString())
                {
                    iFolderPolicy policy = Utils.GetiFolderPolicyObject(ifolderID);
                    policy.Locked = syncStatus;
                    string     ifolderLocation = web.GetiFolderLocation(ifolderID);
                    UriBuilder remoteurl       = new UriBuilder(ifolderLocation);
                    remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                    web.Url        = remoteurl.Uri.ToString();

                    try
                    {
                        web.SetiFolderPolicy(policy);
                    }
                    catch (Exception ex)
                    {
                        TopNav.ShowError(GetString("ERRORCANNOTSETIFOLDERSTATUS"), ex);
                        web.Url = currentServerURL;
                        return;
                    }
                }
            }

            // Clear the checked members.
            CheckediFolders.Clear();
            AlliFoldersCheckBox.Checked = false;

            // Set the action buttons.
            SetActionButtons();
            web.Url = currentServerURL;

            // Rebind the data source with the new data.
            GetiFolders();
        }
Exemple #9
0
        /// <summary>
        /// Page_Load
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void Page_Load(object sender, System.EventArgs e)
        {
            // connection
            web = Session["Connection"] as iFolderAdmin;
            currentServerURL = String.Copy(web.Url);
            reachable        = true;

            // localization
            rm = Application["RM"] as ResourceManager;
//			TopNav.ShowInfo(String.Format("URL: {0}", web.Url));

            userID          = Session["UserID"] as String;
            grpAccessPolicy = web.GetUserGroupRights(userID, null);
            uRights         = new UserGroupAdminRights(grpAccessPolicy);

            if (!IsPostBack)
            {
                // Initialize the localized fields.
                DeleteButton.Text  = GetString("DELETE");
                DisableButton.Text = GetString("DISABLE");
                EnableButton.Text  = GetString("ENABLE");
                //CreateButton.Text = GetString( "CREATE" );

                AlliFoldersLink.Text      = GetString("ALL");
                OrphanediFoldersLink.Text = GetString("ORPHANED");

                // Initialize state variables.
                CurrentiFolderOffset        = 0;
                TotaliFolders               = 0;
                AlliFoldersCheckBox.Checked = false;
                CheckediFolders             = new Hashtable();

                //Set the active ifolder tab
                ActiveiFolderTab = ListDisplayType.All;
            }
            // Set the active ifolder display tab
            SetActiveiFolderListTab(ActiveiFolderTab);
            DeleteButton.Enabled = uRights.DeleteiFolderAllowed;

//			TopNav.ShowInfo(String.Format("URL: {0}", web.Url));
            string code = Thread.CurrentThread.CurrentUICulture.Name;

            if (code.StartsWith("pt") || code.StartsWith("de") || code.StartsWith("ru"))
            {
                DisableButton.Width = 120;
                EnableButton.Width  = 120;
            }
        }
Exemple #10
0
        /// <summary>
        /// event handler that gets called when the provision user button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnProvisionButton_Click(object source, EventArgs e)
        {
            string uplist = "";
            string plist  = "";

            foreach (string userid in CheckedUsers.Keys)
            {
                int preference = GetRightsForUser(userid);
                if (preference == -1)
                {
                    preference = 0xffff;
                }
                UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                if (!rights.ProvisioningAllowed)
                {
                    continue;
                }

                iFolderUser ProvisionedUser = web.GetUser(userid);
                if (ProvisionedUser.HomeServer == null || ProvisionedUser.HomeServer == String.Empty || ProvisionedUser.HomeServer == "")
                {
                    uplist += userid;
                    uplist += ":";
                }
                else
                {
                    plist += userid;
                    plist += ":";
                    plist += ProvisionedUser.HomeServer;
                    plist += ":";
                }
            }

            /// clear the hastable
            ServerProvisioningNames.Clear();
            if ((uplist == null || uplist == string.Empty) && (plist == null || plist == string.Empty))
            {
                string errormessage = GetString("ERRORACCESSEXCEPTION");
                TopNav.ShowError(errormessage);
                return;
            }

            /// call the next page to provision the users
            Response.Redirect(String.Format("ProvisionUsers.aspx?&userlist={0}&puserlist={1}", uplist, plist));
        }
Exemple #11
0
        /// <summary>
        /// Sets the enabled status on all selected users.
        /// </summary>
        /// <param name="status">If true then all selected users will be enabled.</param>
        private void SetSelectedUserStatus(bool status)
        {
            foreach (string userID in CheckedUsers.Keys)
            {
                // Don't set the status if already set.
                if (( bool )CheckedUsers[userID] != status)
                {
                    /// Check for the policy for the groupadmin...
                    int preference = GetRightsForUser(userID);
                    if (preference != -1 && preference != 0xffff)
                    {
                        UserGroupAdminRights rights = new UserGroupAdminRights((int)preference);
                        if (rights.EnableDisableUserAllowed == false)
                        {
                            continue;
                        }
                    }

                    UserPolicy policy = Utils.GetUserPolicyObject(userID);
                    policy.LoginEnabled = status;
                    try
                    {
                        web.SetUserPolicy(policy);
                    }
                    catch (Exception ex)
                    {
                        string errMsg = String.Format(GetString("ERRORCANNOTSETUSERPOLICY"), userID);
                        TopNav.ShowError(errMsg, ex);
                        return;
                    }
                }
            }

            // Clear the checked members.
            CheckedUsers.Clear();
            AllUsersCheckBox.Checked = false;

            // Set the action buttons.
            SetActionButtons();

            // Rebind the data source with the new data.
            GetUsers();
        }
Exemple #12
0
        /// <summary>
        /// Enable / Disable polivy set options based on admin rights
        /// </summary>
        public void DisablePolicyEditBasedOnRighs(int AdminGroupRights)
        {
            UserGroupAdminRights uRights = new UserGroupAdminRights(AdminGroupRights);

            if (uRights.EnableDisableiFolderAllowed == false)
            {
                iFolderEnabled.SetCheckBoxEnabledState = false;
            }
            if (uRights.EnableDisableUserAllowed == false)
            {
                AccountEnabled.SetCheckBoxEnabledState = false;
            }
            if (uRights.DiskQuotaAllowed == false)
            {
                DiskQuota.SetCheckBoxEnabledState = false;
            }
            if (uRights.iFolderLimitAllowed == false)
            {
                iFolderLimit.SetCheckBoxEnabledState = false;
            }
            if (uRights.ChangeEncryptionAllowed == false)
            {
                SecurityState.SetCheckBoxEnabledState = false;
            }
            if (uRights.FileSizeAllowed == false)
            {
                FileSize.SetCheckBoxEnabledState = false;
            }
            if (uRights.AddToExcludePolicyAllowed == false)
            {
                FileType.SetCheckBoxEnabledState = false;
            }

            if (uRights.SyncIntervalAllowed == false)
            {
                SyncInterval.SetCheckBoxEnabledState = false;
            }
            if (uRights.ChangeSharingAllowed == false)
            {
                Sharing.SetCheckBoxEnabledState = false;
            }
        }
Exemple #13
0
        /// <summary>
        /// Event handler that gets called with the delete ifolder button is clicked.
        /// </summary>
        /// <param name="source"></param>
        /// <param name="e"></param>
        protected void OnDeleteButton_Click(object source, EventArgs e)
        {
            string skippediFolderNames = "";

            foreach (string ifolderID in CheckediFolders.Keys)
            {
                try
                {
                    int rights = GetRightsForiFolder(ifolderID);
                    if (rights == -1)
                    {
                        rights = 0xffff;
                    }

                    UserGroupAdminRights adminRights = new UserGroupAdminRights(rights);
                    string ownerID = GetiFolderOwnerID(ifolderID);

                    /*Condition for skipping iFolders for deletion. We allow the owner to
                     * delete his own iFolder. */
                    if (userID != ownerID)
                    {
                        if (!adminRights.DeleteiFolderAllowed)
                        {
                            string ifolderName = GetiFolderName(ifolderID);
                            if (skippediFolderNames.Length > 0)                      //Just for adding a comma.
                            {
                                skippediFolderNames += ", " + ifolderName;
                            }
                            else
                            {
                                skippediFolderNames += ifolderName;
                            }

                            continue;
                        }
                    }

                    string     ifolderLocation = web.GetiFolderLocation(ifolderID);
                    UriBuilder remoteurl       = new UriBuilder(ifolderLocation);
                    remoteurl.Path = (new Uri(web.Url)).PathAndQuery;
                    web.Url        = remoteurl.Uri.ToString();

                    web.DeleteiFolder(ifolderID);
                }
                catch (Exception ex)
                {
                    TopNav.ShowError(GetString("ERRORCANNOTDELETEIFOLDER"), ex);
                    web.Url = currentServerURL;
                    return;
                }
            }
            web.Url = currentServerURL;

            // Clear the checked members.
            CheckediFolders.Clear();
            AlliFoldersCheckBox.Checked = false;

            // Set the action buttons.
            SetActionButtons();

            // Rebind the data source with the new data.
            GetiFolders();

            //If we have skipped some iFolders, tell the admin.
            if (skippediFolderNames.Length > 0)
            {
                TopNav.ShowError(string.Format(GetString("ERRORCANNOTDELETEIFOLDER"), skippediFolderNames));
            }
        }