private void AddCheckPermissions(ScreenName parent, CheckPermissions checkPermissions, IEnumerable <string> propagationPaths, bool addSelfPropagationSource)
        {
            foreach (var propagationKey in propagationPaths)
            {
                HashSet <string> nextPropagationPaths;

                var permissionKey = Pair.Create(propagationKey, parent);
                if (!checkPermissionsForScreenName.ContainsKey(permissionKey))   // No permissions still set for this key

                {
                    if (permissionPropagationPath.TryGetValue(propagationKey, out nextPropagationPaths))
                    {
                        checkPermissionsForScreenName.Add(permissionKey, checkPermissions);

                        AddCheckPermissions(parent, checkPermissions, nextPropagationPaths, /*addSelfPropagationSource*/ true);

                        foreach (var childIndex in childIndexes)
                        {
                            childIndex.AddCheckPermissions(parent, checkPermissions, nextPropagationPaths);
                        }
                    }
                    else
                    {
                        if (addSelfPropagationSource)   // add target of self propagations anyway, since they can be the target server actions
                        {
                            checkPermissionsForScreenName.Add(permissionKey, checkPermissions);
                        }
                    }
                }
            }
        }
Esempio n. 2
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Check source file. </summary>
        ///
        /// <exception cref="FileNotReadableException"> Thrown when a File Not Readable error condition
        ///                                             occurs. </exception>
        /// <exception cref="FileNotFoundException">    Thrown when the requested file is not present. </exception>
        ///
        /// <param name="sourceFile">   Source file. </param>
        ///////////////////////////////////////////////////////////////////////////////////////////

        private void CheckSourceFile(String sourceFile)
        {
            try
            {
                CheckPermissions sourceFilePermissions = new CheckPermissions(sourceFile);
                if (!sourceFilePermissions.CanRead() || !sourceFilePermissions.CanReadData())
                {
                    throw new FileNotReadableException("Could not read source file!");
                }
            }
            catch (IO.FileNotFoundException ex)
            {
                throw new FileNotFoundException("Source file does not exists!", ex);
            }
        }
Esempio n. 3
0
        ///////////////////////////////////////////////////////////////////////////////////////////
        /// <summary>   Check destination file. </summary>
        ///
        /// <exception cref="FileNotWritableException"> Thrown when a File Not Writable error condition
        ///                                             occurs. </exception>
        /// <exception cref="FileNotFoundException">    Thrown when the requested file is not present. </exception>
        ///
        /// <param name="destinationFile">  Destination file. </param>
        ///////////////////////////////////////////////////////////////////////////////////////////

        private void CheckDestinationFile(String destinationFile)
        {
            try
            {
                CheckPermissions destFilePermissions = new CheckPermissions(IO.Path.GetDirectoryName(destinationFile));

                if (!destFilePermissions.CanWrite() || !destFilePermissions.CanWriteData())
                {
                    throw new FileNotWritableException("Could not write to destination file!");
                }
            }
            catch (IO.FileNotFoundException ex)
            {
                throw new FileNotFoundException("Destination file does not exists!", ex);
            }
        }
Esempio n. 4
0
        public ActionResult Users()
        {
            int  action = 0;
            bool status = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"]);
                string[] permission = CheckAdminPermissions.permission("Manage Users", userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"]);
                string[] permission = CheckPermissions.permission("Manage Users", userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            if (status == false)
            {
                string url = "~/Home/NoPermission";
                return(Redirect(url));
            }
            ViewBag.Action = action;
            ViewBag.Status = status;
            ManageUserModel  model    = new ManageUserModel();
            List <UserModel> UserList = new List <UserModel>();

            actionResult = adminAction.Users_LoadAll();
            if (actionResult.IsSuccess)
            {
                UserList = CommonMethods.ConvertTo <UserModel>(actionResult.dtResult);
            }
            model.UserList = UserList;
            return(View(model));
        }
Esempio n. 5
0
        private void buttonLogin_Click(object sender, EventArgs e)
        {
            warehouseDatabaseEntities1 context = new warehouseDatabaseEntities1();

            if (textBoxLogin.Text != string.Empty || textBoxHaslo.Text != string.Empty)
            {
                var user = context.Users.Where(u => u.login.Equals(textBoxLogin.Text)).FirstOrDefault();

                if (user != null)
                {
                    CheckPermissions checkPermissions = new CheckPermissions(user.usersID);

                    if (user.password.Equals(textBoxHaslo.Text))
                    {
                        this.id = user.usersID;
                        if (!checkPermissions.administrator())
                        {
                            FormZalogowany success = new FormZalogowany(this.id);
                            success.Show();
                            this.Hide();
                        }
                        else
                        {
                            FormAdmin admin = new FormAdmin();
                            admin.Show();
                            this.Hide();
                        }
                    }
                    else
                    {
                        MessageBox.Show("Błędny login lub hasło");
                    }
                }
                else
                {
                    MessageBox.Show("Błędny login lub hasło");
                }
            }
            else
            {
                MessageBox.Show("Uzupełnij login i hasło");
            }
        }
Esempio n. 6
0
        public ActionResult Index(string type = "", string subtype = "", int subFeatureid = 0, int typeid = 0)
        {
            ViewBag.Type         = type;
            ViewBag.SubType      = subtype;
            ViewBag.SubFeatureid = subFeatureid;
            ViewBag.id           = typeid;
            int  action = 0;
            bool status = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"]);
                string[] permission = CheckAdminPermissions.permission((type == "Employee" ? "Employees" : type), userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"]);
                string[] permission = CheckPermissions.permission((type == "Employee" ? "Employees" : type), userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }

            if (status == false)
            {
                string url = "~/Home/NoPermission";
                return(Redirect(url));
            }
            ViewBag.Action = action;
            ViewBag.Status = status;
            return(View());
        }
Esempio n. 7
0
        public async Task SetColorCommand(string color)
        {
            SocketGuildUser user    = Context.Guild.Users.Where(c => c.Id == Context.User.Id).First();
            MessageHandler  handler = new MessageHandler();

            if (!CheckPermissions.CheckUserInChannel(user, Context.Channel as SocketTextChannel, "changing-room"))
            {
                await ReplyAsync("", false, handler.BuildEmbed("uwu Oopsie whoopsie", $"I'm sowwy :3 but it wooks wike you haw to call thish command fwom <#422886537068412929> owo").Build());

                return;
            }

            if (color == "none")
            {
                await user.RemoveRolesAsync(Context.Guild.Roles.Where(c => ColorRoles.Contains(c.Name)));
                await ReplyAsync("", false, handler.BuildEmbed("Removed color", $"Not so shiny.").Build());

                Debugging.Log("SetColorCommand", $"Removed colors for {user.Username}");
                return;
            }

            color = $"[{color}]";
            if (ColorRoles.Contains(color))
            {
                await user.RemoveRolesAsync(Context.Guild.Roles.Where(c => ColorRoles.Contains(c.Name)));

                await user.AddRoleAsync(Context.Guild.Roles.Where(c => c.Name == color).First());
                await ReplyAsync("", false, handler.BuildEmbed("New color set!", $"Shiny.").Build());

                Debugging.Log("SetColorCommand", $"Set new color for {user.Username}");
                return;
            }
            else
            {
                await ReplyAsync("", false, handler.BuildEmbed("Color doesn't exist", $"Try one of these: `red`, `orange`, `yellow`, `green`, `blue`, `purple` or `none` to reset").Build());

                return;
            }
        }
Esempio n. 8
0
        public override void OnActionExecuting(ActionExecutingContext filterContext)
        {
            var  controller = HttpContext.Current.Request.RequestContext.RouteData.Values["controller"].ToString();
            int  action     = 0;
            bool status     = false;

            if (filterContext.HttpContext.Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(filterContext.HttpContext.Session["Admin"]);
                string[] permission = CheckAdminPermissions.permission(controller, userId);

                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }

            else if (filterContext.HttpContext.Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(filterContext.HttpContext.Session["UserId"]);
                string[] permission = CheckPermissions.permission(controller, userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            if (status == false)
            {
                string url = "~/Home/NoPermission";
                filterContext.Result = new RedirectResult(url);
            }
            filterContext.Controller.ViewBag.Action = action;
            filterContext.Controller.ViewBag.Status = status;
        }
Esempio n. 9
0
        public ActionResult DeleteUser(int?Id = 0)
        {
            int  action = 0;
            bool status = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"]);
                string[] permission = CheckAdminPermissions.permission("Manage Users", userId);

                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"]);
                string[] permission = CheckPermissions.permission("Manage Users", userId);
                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            if (status == false)
            {
                string url = "~/Home/NoPermission";
                return(Redirect(url));
            }
            ViewBag.Action = action;
            ViewBag.Status = status;

            string json = string.Empty;

            try
            {
                UserBase userBase = new UserBase();
                userBase.ID = Convert.ToInt32(Id);

                actionResult = adminAction.User_DeleteById(userBase);
                if (actionResult.IsSuccess)
                {
                    int result = Convert.ToInt32(actionResult.dtResult.Rows[0][0]);
                    if (result == -10)
                    {
                        json = "-10";
                    }
                    else
                    {
                        json = "success";
                    }
                }
                else
                {
                    json = "-1";
                }
            }
            catch (Exception ex)
            {
                json = "-1";
                ErrorReporting.WebApplicationError(ex);
            }
            return(Json(json, JsonRequestBehavior.AllowGet));
        }
Esempio n. 10
0
        public ActionResult ManageUsers(int?Id = 0)
        {
            int  action = 0;
            bool status = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"]);
                string[] permission = CheckAdminPermissions.permission("Manage Users", userId);

                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"]);
                string[] permission = CheckPermissions.permission("Manage Users", userId);
                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            if (status == false)
            {
                string url = "~/Home/NoPermission";
                return(Redirect(url));
            }
            ViewBag.Action = action;
            ViewBag.Status = status;
            UserModel model = new UserModel();

            if (Id > 0)
            {
                UserBase userBase = new UserBase();
                userBase.ID  = Convert.ToInt32(Id);
                actionResult = adminAction.User_LoadById(userBase);
                if (actionResult.IsSuccess)
                {
                    DataRow dr = actionResult.dtResult.Rows[0];
                    model.ID        = dr["ID"] != DBNull.Value ? Convert.ToInt32(dr["ID"]) : 0;
                    model.FirstName = dr["FirstName"] != DBNull.Value ? dr["FirstName"].ToString() : "";
                    model.LastName  = dr["LastName"] != DBNull.Value ? dr["LastName"].ToString() : "";
                    model.Initials  = dr["Initials"] != DBNull.Value ? dr["Initials"].ToString() : "";
                    model.UserName  = dr["UserName"] != DBNull.Value ? dr["UserName"].ToString() : "";

                    model.RegNumber      = dr["RegNumber"] != DBNull.Value ? dr["RegNumber"].ToString() : "";
                    model.Skills         = dr["Skills"] != DBNull.Value ? dr["Skills"].ToString() : "";
                    model.EMail          = dr["EMail"] != DBNull.Value ? dr["EMail"].ToString() : "";
                    model.UserName       = dr["UserName"] != DBNull.Value ? dr["UserName"].ToString() : "";
                    model.Roles          = dr["Roles"] != DBNull.Value ? dr["Roles"].ToString() : "";
                    model.UnitID         = dr["UnitID"] != DBNull.Value ? Convert.ToInt32(dr["UnitID"]) : 0;
                    model.IsDispatchable = dr["IsDispatchable"] != DBNull.Value ? Convert.ToBoolean(dr["IsDispatchable"]) : false;
                }

                actionResult = adminAction.UserRoles_LoadAll();
                if (actionResult.IsSuccess)
                {
                    model.RolesList = CommonMethods.ConvertTo <Roles>(actionResult.dtResult);
                }
            }
            return(View(model));
        }
Esempio n. 11
0
        public ActionResult RolePermissions(int?Id = 0)
        {
            int  action = 0;
            bool status = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"]);
                string[] permission = CheckAdminPermissions.permission("Manage Roles", userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }

            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"]);
                string[] permission = CheckPermissions.permission("Manage Roles", userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }
            }
            if (status == false)
            {
                string url = "~/Home/NoPermission";
                return(Redirect(url));
            }
            ViewBag.Action = action;
            ViewBag.Status = status;
            Roles        model    = new Roles();
            List <Roles> roleList = new List <Roles>();

            model.RolesList = roleList;
            model.RoleId    = Convert.ToInt32(Id);

            actionResult = adminAction.UserRoles_LoadAll();
            if (actionResult.IsSuccess)
            {
                model.RolesList = CommonMethods.ConvertTo <Roles>(actionResult.dtResult);
            }

            if (model.RoleId > 0)
            {
                for (int i = 0; i < model.RolesList.Count; i++)
                {
                    if (model.RolesList[i].RoleId == model.RoleId)
                    {
                        ViewBag.RoleName = model.RolesList[i].RoleName;
                        ViewBag.RoleID   = model.RolesList[i].RoleId;
                    }
                }
            }
            if (ViewBag.RoleName == null)
            {
                ViewBag.RoleName = "";
            }

            if (model.RolesList.Count > 0 && Id == 0)
            {
                model.RoleId = model.RolesList[0].RoleId;
            }


            actionResult = adminAction.Menus_LoadForSiteAdministrator();
            if (actionResult.IsSuccess)
            {
                model.MenusList = CommonMethods.ConvertTo <Menus>(actionResult.dtResult);
            }
            //.OrderBy(m => m.ParentId).ToList()

            //actionResult = adminAction.SubMenu_LoadAll();
            //if (actionResult.IsSuccess)
            //    model.SubMenusList = CommonMethods.ConvertTo<SubMenus>(actionResult.dtResult);

            //roleBase.ID = Convert.ToInt32(Id);
            //SubMenus subMenusModel = new SubMenus();
            //actionResult = adminAction.SubMenuPermissions(roleBase);
            //if (actionResult.IsSuccess)
            //{
            //    DataRow dr = actionResult.dtResult.Rows[0];
            //    subMenusModel.ParentID = dr["ParentID"] != DBNull.Value ? Convert.ToInt32(dr["ParentID"]) : 0;
            //    subMenusModel.Roles = dr["SubMenus"] != DBNull.Value ? dr["SubMenus"].ToString() : "";
            //}
            //model.SubMenusModel = subMenusModel;
            // dhaval

            DataTable dt = new DataTable();

            dt = getbackground("");

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_logo"].ToString().Length > 0)
            {
                ViewBag.Corporate_logo = dt.Rows[0]["Corporate_logo"].ToString();
            }
            else
            {
                ViewBag.Corporate_logo = "admin-logo.png";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Customer_logo"].ToString().Length > 0)
            {
                ViewBag.Customer_logo = dt.Rows[0]["Customer_logo"].ToString();
            }
            else
            {
                ViewBag.Customer_logo = "";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_background"].ToString().Length > 0)
            {
                ViewBag.Corporate_background = dt.Rows[0]["Corporate_background"].ToString();
            }
            else
            {
                ViewBag.Corporate_background = "#f79646";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_back_type"].ToString().Length > 0)
            {
                ViewBag.Corporate_back_type = dt.Rows[0]["Corporate_back_type"].ToString();
            }
            else
            {
                ViewBag.Corporate_back_type = "palette";
            }

            return(View(model));
        }
Esempio n. 12
0
        public ActionResult Index()
        {
            CIMS.ActionLayer.Employee.EmployeeAction employeeAction = new CIMS.ActionLayer.Employee.EmployeeAction();
            CIMS.BaseLayer.Employee.EmployeeBase     employeeBase   = new CIMS.BaseLayer.Employee.EmployeeBase();
            List <EmployeeModel> employeeList = new List <EmployeeModel>();
            EmployeeModel        model        = new EmployeeModel();

            employeeBase.UserID = Convert.ToInt32(Session["UserId"]);
            employeeBase.RoleID = Convert.ToInt32(Session["RoleId"]);
            actionResult        = employeeAction.Employees_dashboard(employeeBase);
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                employeeList = (from DataRow row in actionResult.dtResult.Rows
                                select new EmployeeModel
                {
                    EmployeeID = row["EmployeeID"] != DBNull.Value ? Convert.ToInt32(row["EmployeeID"]) : 0,
                    FirstName = row["FirstName"] != DBNull.Value ? row["FirstName"].ToString() : "",
                    MiddleName = row["MiddleName"] != DBNull.Value ? row["MiddleName"].ToString() : "",
                    LastName = row["LastName"] != DBNull.Value ? row["LastName"].ToString() : "",
                    CreatedByUser = row["CreatedByUser"] != DBNull.Value ? row["CreatedByUser"].ToString() : "",
                    CreatedDate = row["CreatedDate"] != DBNull.Value ? row["CreatedDate"].ToString() : "",
                    TotalEmployees = row["TotalEmployees"] != DBNull.Value ? row["TotalEmployees"].ToString() : "",
                    FilePath = row["FilePath"] != DBNull.Value ? Convert.ToString(row["FilePath"]) : null
                }).ToList();
            }
            CIMS.ActionLayer.VisitorAction visitorAction = new CIMS.ActionLayer.VisitorAction();
            List <VisitorModel>            visitorList   = new List <VisitorModel>();
            VisitorModel visitorModel = new VisitorModel();

            actionResult = visitorAction.Visitor_dashboard();
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                visitorList = (from DataRow row in actionResult.dtResult.Rows
                               select new VisitorModel
                {
                    VisitorID = row["VisitorID"] != DBNull.Value ? Convert.ToInt32(row["VisitorID"]) : 0,
                    VisitorName = row["VisitorName"] != DBNull.Value ? row["VisitorName"].ToString() : "",
                    CreatedByUser = row["CreatedByUser"] != DBNull.Value ? row["CreatedByUser"].ToString() : "",
                    CreatedDate = row["CreatedDate"] != DBNull.Value ? row["CreatedDate"].ToString() : "",
                    TotalVisit = row["TotalVisit"] != DBNull.Value ? row["TotalVisit"].ToString() : "",
                    ImagePath = row["ImagePath"] != DBNull.Value ? row["ImagePath"].ToString() : ""
                }).ToList();
            }
            CIMS.ActionLayer.Subject.SubjectAction subjectAction = new CIMS.ActionLayer.Subject.SubjectAction();
            CIMS.BaseLayer.Subject.SubjectBase     subjectBase   = new CIMS.BaseLayer.Subject.SubjectBase();
            List <SubjectModel> subjectList  = new List <SubjectModel>();
            SubjectModel        subjectModel = new SubjectModel();

            subjectBase.CreatedBy = Convert.ToInt32(Session["UserId"]);
            subjectBase.RoleID    = Convert.ToInt32(Session["RoleId"]);
            actionResult          = subjectAction.Subject_dashboard(subjectBase);
            if (actionResult.IsSuccess && actionResult.dtResult.Rows.Count > 0)
            {
                subjectList = (from DataRow row in actionResult.dtResult.Rows
                               select new SubjectModel
                {
                    SubjectID = row["SubjectID"] != DBNull.Value ? Convert.ToInt32(row["SubjectID"]) : 0,
                    FirstName = row["FirstName"] != DBNull.Value ? row["FirstName"].ToString() : "",
                    MiddleName = row["MiddleName"] != DBNull.Value ? row["MiddleName"].ToString() : "",
                    LastName = row["LastName"] != DBNull.Value ? row["LastName"].ToString() : "",
                    CreatedByUser = row["CreatedByUser"] != DBNull.Value ? row["CreatedByUser"].ToString() : "",
                    ModifiedDate = row["ModifiedDate"] != DBNull.Value ? row["ModifiedDate"].ToString() : "",
                    TotalSubjects = row["TotalSubjects"] != DBNull.Value ? row["TotalSubjects"].ToString() : "",
                    FilePath = row["FilePath"] != DBNull.Value ? Convert.ToString(row["FilePath"]) : null
                }).ToList();
            }
            model.EmployeeList = employeeList;

            visitorModel.VisitorList = visitorList;
            model.visitorNewModel    = visitorModel;

            subjectModel.SubjectList = subjectList;
            model.subjectNewModel    = subjectModel;


            // dhaval

            DataTable dt = new DataTable();

            dt = getbackground("");

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_logo"].ToString().Length > 0)
            {
                ViewBag.Corporate_logo = dt.Rows[0]["Corporate_logo"].ToString();
            }
            else
            {
                ViewBag.Corporate_logo = "admin-logo.png";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Customer_logo"].ToString().Length > 0)
            {
                ViewBag.Customer_logo = dt.Rows[0]["Customer_logo"].ToString();
            }
            else
            {
                ViewBag.Customer_logo = "admin-logo.png";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_background"].ToString().Length > 0)
            {
                ViewBag.Corporate_background = dt.Rows[0]["Corporate_background"].ToString();
            }
            else
            {
                ViewBag.Corporate_background = "#f79646";
            }

            if (dt.Rows.Count > 0 && dt.Rows[0]["Corporate_back_type"].ToString().Length > 0)
            {
                ViewBag.Corporate_back_type = dt.Rows[0]["Corporate_back_type"].ToString();
            }
            else
            {
                ViewBag.Corporate_back_type = "palette";
            }


            // Employee

            var controller  = "Employees";
            var controller1 = "Subject";

            int  action = 0;
            bool status = false;

            int  action1 = 0;
            bool status1 = false;

            if (Session["Admin"] != null)
            {
                int      userId     = Convert.ToInt32(Session["Admin"].ToString());
                string[] permission = CheckAdminPermissions.permission(controller, userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }

                permission = CheckAdminPermissions.permission(controller1, userId);


                if (permission != null)
                {
                    action1 = Convert.ToInt32(permission[1]);
                    status1 = Convert.ToBoolean(permission[0]);
                }
            }

            else if (Session["UserId"] != null)
            {
                int      userId     = Convert.ToInt32(Session["UserId"].ToString());
                string[] permission = CheckPermissions.permission(controller, userId);


                if (permission != null)
                {
                    action = Convert.ToInt32(permission[1]);
                    status = Convert.ToBoolean(permission[0]);
                }

                permission = CheckPermissions.permission(controller1, userId);


                if (permission != null)
                {
                    action1 = Convert.ToInt32(permission[1]);
                    status1 = Convert.ToBoolean(permission[0]);
                }
            }

            ViewBag.Action = action;
            ViewBag.Status = status;

            ViewBag.Action1 = action1;
            ViewBag.Status1 = status1;

            // Subject


            return(View(model));
        }
 private void AddCheckPermissions(ScreenName parent, CheckPermissions checkPermissions, IEnumerable <string> propagationPaths)
 {
     AddCheckPermissions(parent, checkPermissions, propagationPaths, /*addSelfPropagationSource*/ false);
 }
 public void AddCheckPermissions(ScreenName parent, CheckPermissions checkPermissions)
 {
     AddCheckPermissions(parent, checkPermissions, permissionPropagationPath.Keys, /*addSelfPropagationSource*/ false);
 }
 public bool TryGetCheckPermissions(ScreenName parentName, String usageKey, out CheckPermissions checkPermissions)
 {
     return(checkPermissionsForScreenName.TryGetValue(Pair.Create(usageKey, parentName), out checkPermissions));
 }
 public bool TryGetCheckPermissions(ScreenName parentName, out CheckPermissions checkPermissions)
 {
     return(TryGetCheckPermissions(parentName, ANY_USAGE_KEY, out checkPermissions));
 }