コード例 #1
0
        public ActionResult Finalize(int id)
        {
            var username = User.Identity.GetUserName();
            RoleAssignmentMatrix roleAssignmentMatrix = db.RoleAssignmentMatrix.SingleOrDefault(m => m.UserName == username);

            ViewBag.IsValidRole = roleAssignmentMatrix.Billing;

            BillingRegenerateBLL billingRegenerateBLL = new BillingRegenerateBLL(id);

            if (billingRegenerateBLL.FinalizeBilling())
            {
                Response.Write("Billing period has been finalized.");
                SL.LogInfo(User.Identity.Name, Request.RawUrl, "Billing Generate- Billing period has been finalized.  - from Terminal: " + ipaddress);
            }
            else
            {
                Response.Write("Failed to finalize billing period. Please contact your system administrator.");
                SL.LogError(User.Identity.Name, Request.RawUrl, "Billing Generate -Failed to finalize billing period  - from Terminal: " + ipaddress);
            }
            var userid = User.Identity.GetUserId();
            ApplicationUserManager UserManager = HttpContext.GetOwinContext().GetUserManager <ApplicationUserManager>(); //initialize usermanager
            var rolename          = UserManager.GetRoles(userid).FirstOrDefault();                                       //get the role name of current user
            UserAccessControl uac = new UserAccessControl("billing", rolename);

            ViewBag.IsValidRole = uac.userCanAccess();

            List <BillingPeriod> billingperiodlist = new List <BillingPeriod>();

            billingperiodlist = db.BillingPeriod.ToList();
            //return View("ViewGenerate", billingperiodlist);
            return(RedirectToAction("ViewGeneratePRG", "BillingGenerate"));
        }
コード例 #2
0
 /// <summary>
 /// Occurs when user access control (ACL) has been changed.
 /// </summary>
 /// <param name="control">The new user access control data.</param>
 protected virtual void OnUserAccessControlChanged(UserAccessControl control)
 {
     if (UserAccessControlChanged != null)
     {
         UserAccessControlChanged(this, control);
     }
 }
コード例 #3
0
        /// <summary>
        /// Restricts access to the fax functionality for the device.
        /// </summary>
        /// <param name="deviceId">The internal id of the device. If null, then ignore or don't modify attribute.</param>
        /// <param name="currentAccessControl">The existing <see cref="UserAccessControl"/> settings.</param>
        /// <param name="accessControl">The device controls to modify.</param>
        /// <param name="allow">Enable or disable access. If null, then ignore or don't modify attribute.</param>
        /// <returns>True if the call was successful, false if otherwise.</returns>
        protected bool SetAccessControl(uint deviceId, UserAccessControl currentAccessControl, DeviceAccessControl accessControl, bool allow = false)
        {
            return(Connect(() => {
                try {
                    IEnumerable <field> fields = currentAccessControl.Fields.GetUpdatableFields(f => f.Type == typeof(bool));
                    if ((fields == null) || (!fields.Any()))
                    {
                        return (false);
                    }

                    IEnumerable <string> names = accessControl.GetExternalNames(); // Get all of the external names that match the requested accessControl type.

                    // Update the requested changes.
                    fields.AsParallel().ForAll(f => {
                        if (names.Any(n => String.Equals(n, f.name, StringComparison.CurrentCultureIgnoreCase)))
                        {
                            // The external service views the ON / OFF from a RESTRICTION point of view instead of ALLOW
                            bool toogle = !allow;// f.IsFax() ? ! allow :allow;

                            Trace.TraceWarning("Changing accessControl '{1}' from '{2}' to '{3}' for {0}.", currentAccessControl.Id, f.name, f.value, toogle.ToOnOff());
                            f.value = toogle.ToOnOff();
                        }
                    });

                    return (Update(deviceId,
                                   Convert.ToString(currentAccessControl.Index), currentAccessControl.Id,
                                   fields.ToArray(), USAGE_CONTROL_USER, false));
                } catch (Exception e) {
                    Trace.TraceError(e.Message);
                    Trace.TraceError(e.StackTrace);

                    throw (new RicohOperationFailedException(this, "Restrict", e));
                }
            }));
        }
コード例 #4
0
        public void ShowLogin()
        {
            UserAccessControl.Login();

            //PopUpContextForm.Show(
            //    _userLoginControl,
            //    btnLogin,
            //    new Size(307, 105),
            //    new Point(-300, btnLogin.Height));
        }
コード例 #5
0
        /// <summary>
        /// Retrieves all the current user restrictions / permissions from the system.
        /// </summary>
        /// <param name="deviceId">The internal id of the device.</param>
        /// <returns>The collection of user counters for the device.</returns>
        public IEnumerable <UserAccessControl> GetUserAccessControls(uint deviceId = 0)
        {
            IList <UserAccessControl> userAccessControls = new List <UserAccessControl>();

            return(Connect(() => {
                Trace.TraceInformation("Retrieving all objects for {0}", USAGE_CONTROL_USER);
                try {
                    string[] objectIds = Client.getObjects(SessionId, deviceId, USAGE_CONTROL_USER);
                    if ((objectIds != null) && (objectIds.Length > 0))
                    {
                        Trace.TraceInformation("{0} objects: {1}", USAGE_CONTROL_USER, String.Join(",", objectIds));

                        // Get the "default" object capabilities
                        objectCapability capability = GetDefaultObjectCapability(deviceId, objectIds);

                        // In parallel, retrieve the access controls for the user.
                        objectIds.AsParallel().ForAll((i) => {
                            uint objectId;
                            if (UInt32.TryParse(i, out objectId))
                            {
                                UserAccessControl accessControl = GetUserAccessControl(objectId, deviceId, ref capability);
                                if (accessControl != null)
                                {
                                    OnUserAccessControlRetrieved(accessControl);
                                    userAccessControls.Add(accessControl);
                                }
                            }
                        });
                    }
                    return (userAccessControls);
                } catch (Exception e) {
                    Trace.TraceError(e.Message);
                    Trace.TraceError(e.StackTrace);

                    throw (new RicohOperationFailedException(this, "GetUserRestrictions", e));
                }
            }));
        }
コード例 #6
0
        private void btn_Save_Click(object sender, EventArgs e)
        {
            if (cb_User.SelectedValue == null)
            {
                Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("هشدار", "نام كاربر را انتخاب نماييد", "e");
                cb_User.Focus();
                cb_User.DroppedDown = true;
                return;
            }
            Atiran.Connections.Operaions.SubSystemPermissionOp.SubSystemPermissionOperaion.DeleteModulePermission(int.Parse(cb_User.SelectedValue.ToString()));
            Atiran.Connections.Operaions.SubSystemPermissionOp.SubSystemPermissionOperaion.insertToModulePermission(int.Parse(cb_User.SelectedValue.ToString()), ModuleNodes.Distinct().ToList(), ModuleNodesOrginal.Distinct().ToList());
            CustomMessageForm.CustomMessageBox.Show("پیغام", " ثبت با موفقیت انجام گرفت ");
            DialogResult x = Atiran.UI.WindowsForms.MessageBoxes.CustomMessageForm.CustomMessageBox.Show("پيغام", "آيا ميخواهيد براي كاربر تعريف شده، تعيين سطوح دسترسي زير سيستم‌ها را مشخص كنيد؟", "w");

            if (x == DialogResult.Yes)
            {
                UserAccessControl UAC    = new UserAccessControl(true, int.Parse(cb_User.SelectedValue.ToString()));
                UserControlLoader loader = new UserControlLoader(UAC);
            }
            if (status)
            {
                this.ParentForm.Close();
            }
        }
コード例 #7
0
 private void buttonAcknowledge_Click(object sender, EventArgs e)
 {
     UserAccessControl.SetSessionTimeOut(100);
     UserAccessControl.Login();
 }
コード例 #8
0
 /// <summary>
 /// Allows access to the specified device functions for the device.
 /// </summary>
 /// <param name="currentAccessControl">The existing <see cref="UserAccessControl"/> settings.</param>
 /// <param name="accessControl">The device controls to modify.</param>
 /// <param name="deviceId">The internal id of the device.</param>
 /// <returns>True if the call was successful, false if otherwise.</returns>
 public bool AllowAccess(UserAccessControl currentAccessControl, DeviceAccessControl accessControl, uint deviceId = 0)
 {
     return(SetAccessControl(deviceId, currentAccessControl, accessControl, true));
 }
コード例 #9
0
 /// <summary>
 /// Restricts access to the specified device functions for the device.
 /// </summary>
 /// <param name="currentAccessControl">The existing <see cref="UserAccessControl"/> settings.</param>
 /// <param name="accessControl">The device controls to modify.</param>
 /// <param name="deviceId">The internal id of the device.</param>
 /// <returns>True if the call was successful, false if otherwise.</returns>
 public bool RestrictAccess(UserAccessControl currentAccessControl, DeviceAccessControl accessControl, uint deviceId = 0)
 {
     return(SetAccessControl(deviceId, currentAccessControl, accessControl, false));
 }