Пример #1
0
        public ActionResult DefineRolesStep1(string id, string newUserProfileIdentifier)
        {
            //Get SystemUsers
            SystemUser systemUser = new SystemUser();

            systemUser = systemUserRepository.GetUserBySystemUserGuid(id);

            SystemUser newSystemUser = new SystemUser();

            newSystemUser = systemUserRepository.GetUserByUserProfileIdentifier(newUserProfileIdentifier);

            //Check Exists
            if (systemUser == null || newSystemUser == null)
            {
                ViewData["ActionMethod"] = "DefineRolesStep1";
                return(View("RecordDoesNotExistError"));
            }

            //Check AccessRights
            RolesRepository rolesRepository = new RolesRepository();

            if (!rolesRepository.HasWriteAccessToSystemUserRoles(systemUser.SystemUserGuid) ||
                !rolesRepository.HasWriteAccessToSystemUserRoles(newSystemUser.SystemUserGuid))
            {
                return(View("Error"));
            }

            return(RedirectToAction("DefineRolesStep2", new { id = id, newUserProfileIdentifier = newUserProfileIdentifier }));
        }