diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000..722a051 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,46 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +In the interest of fostering an open and welcoming environment, we as contributors and maintainers pledge to making participation in our project and our community a harassment-free experience for everyone, regardless of age, body size, disability, ethnicity, gender identity and expression, level of experience, nationality, personal appearance, race, religion, or sexual identity and orientation. + +## Our Standards + +Examples of behavior that contributes to creating a positive environment include: + +* Using welcoming and inclusive language +* Being respectful of differing viewpoints and experiences +* Gracefully accepting constructive criticism +* Focusing on what is best for the community +* Showing empathy towards other community members + +Examples of unacceptable behavior by participants include: + +* The use of sexualized language or imagery and unwelcome sexual attention or advances +* Trolling, insulting/derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or electronic address, without explicit permission +* Other conduct which could reasonably be considered inappropriate in a professional setting + +## Our Responsibilities + +Project maintainers are responsible for clarifying the standards of acceptable behavior and are expected to take appropriate and fair corrective action in response to any instances of unacceptable behavior. + +Project maintainers have the right and responsibility to remove, edit, or reject comments, commits, code, wiki edits, issues, and other contributions that are not aligned to this Code of Conduct, or to ban temporarily or permanently any contributor for other behaviors that they deem inappropriate, threatening, offensive, or harmful. + +## Scope + +This Code of Conduct applies both within project spaces and in public spaces when an individual is representing the project or its community. Examples of representing a project or community include using an official project e-mail address, posting via an official social media account, or acting as an appointed representative at an online or offline event. Representation of a project may be further defined and clarified by project maintainers. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by contacting the project team at mtrutledge@gmail.com. The project team will review and investigate all complaints, and will respond in a way that it deems appropriate to the circumstances. The project team is obligated to maintain confidentiality with regard to the reporter of an incident. Further details of specific enforcement policies may be posted separately. + +Project maintainers who do not follow or enforce the Code of Conduct in good faith may face temporary or permanent repercussions as determined by other members of the project's leadership. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4, available at [http://contributor-covenant.org/version/1/4][version] + +[homepage]: http://contributor-covenant.org +[version]: http://contributor-covenant.org/version/1/4/ diff --git a/.github/CONTRIBUTING.md b/.github/CONTRIBUTING.md new file mode 100644 index 0000000..ccfb31b --- /dev/null +++ b/.github/CONTRIBUTING.md @@ -0,0 +1,64 @@ +# How to contribute + +Community contributions are essential part of any open source project. The community has access to a large number of unique configurations which would be extremely difficult for the core maintainers to reproduce. We want to keep it as easy as possible to contribute changes that get things working in your environment. There are a few guidelines that we need contributors to follow so that we can have a chance of keeping on top of things. + +Make sure you have a [GitHub account](https://github.com/signup/free) to start with. + +## Level 1 contributions: easy ways to contribute +There are several ways to contribute, depending on your background, level of expertise and willingness to spend some time. Everybody should be able to contribute on a minimal level: +* Create or document issues +* Create or improve documentation +* Be a tester + +### Create issues +Anybody with a GutHub account can create new issues. Please verify that a simlar issue has not been created before. Clearly describe the issue you encounter. + +### Create or improve documentation +Create an issue with suggestions for document improvements. If you have an idea about the new documenation, add that text (prefereably in markdown format) in the issue as proposed new or improved documentation. + +### Be a tester +Download an install version of the extension and test it in your own environment. If you are reviewing issues, try to reproduce issues that have been created and enhance documentation of the issue to reproduce any bugs. + +If there is a new version of an extension, be one of the first to test that new version on a fresh install and as an upgrade of a previous version. Report your findings as issues. + +# Level 2 contributions: Provide improved or new code +If you are commited as community member and have programming skills, there is more that you can do: +* Create code fixes +* Create new functionality + +We asume that you have some basic Git(Hub) knowledge and know how to work with fork, clone, create issue, commit, push, pull requests + +## Get started with code contributions + +### Fork the repository on GitHub +If this is your first time working with the repository, you will need to fork the repository to get your system configured for local development. + +If you are new to Dnn Development, you can start by watching this video playlist which explains how to setup the required tools, your development environment and submit pull requests for modules, the Platform and the Persona Bar. +[How to make a pull requests playlist](https://www.youtube.com/playlist?list=PLIx1M8IdVvqZ0bnODGqJyxvONNPj5BzMP) + +* Click fork on the project. You will get a fork of the repository in your own GitHub account +* Clone your fork locally with `git clone +* Add the *upstream connection* to the original repository, so you can rebase and update your fork with `git remote add upstream` to the base (the original) repository +* To update your fork to the latest, you can then run `git fetch upstream` followed by `git push` + +## Making Changes +* Create a topic branch from where you want to base your work. This is usually a branch linked to the *issue #* your are trying to solve +* Make commits of logical units +* When ready to publish your changes, you can with `git push -u origin my_contribution` +* Make sure your pull request description tags the GitHub issue ID, so it is clear what issue you have fixed +* Make sure your commit messages are in the proper format + +## Submitting changes +* Push your changes to a topic branch in your fork of the repository +* Submit a pull request to the original (upstream( repository +* The committers will handle updating the associated issue in the DNN Tracker to ensure it gets the necessary code review and QA + +## Acceptance of your changes +* We have a group of fellow developers that review pull requests submitted by developers like yourself +* If your changes look good, then changes are merged to an appropriate release +* You should get an email notification as we complete processing of your pull request + +# Level 3 contributions: Become a repository custodian +If you are really commited, want to work with highly commited team members (like yourself?) and want to contibute by taking care of one or more repositories, you might want to become a *repository custodian*. + +Contact one of the team members of the organisation and discuss the opportunities. diff --git a/.github/FUNDING.yml b/.github/FUNDING.yml new file mode 100644 index 0000000..e622fdc --- /dev/null +++ b/.github/FUNDING.yml @@ -0,0 +1 @@ +github: UpendoVentures diff --git a/.github/ISSUE_TEMPLATE/bug-report.md b/.github/ISSUE_TEMPLATE/bug-report.md new file mode 100644 index 0000000..040e57a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/bug-report.md @@ -0,0 +1,52 @@ +--- +name: Bug Report +about: Create a report to help us improve + +--- + +## Sponsorship + + +If this request requires additional support (e.g., such as direct email/phone/meeting/development), I have the following interest in helping to [sponsor the effort via GitHub Sponsors](https://github.com/sponsors/UpendoVentures): + +- [ ] None, please continute to work for me for free :P +- [ ] Absolutely, I get value out of this! +- [ ] Maybe later +- [ ] I'm already a sponsor... Woot! + +## Describe the bug +A clear and concise description of what the bug is. + +## Software Versions +- DNN: 00.00.00 +- Module: 00.00.00 + +## To Reproduce +Steps to reproduce the behavior: +1. Go to '...' +2. Click on '....' +3. Scroll down to '....' +4. See error + +## Expected behavior +A clear and concise description of what you expected to happen. + +## Actual behavior +A clear and concise description of what happened instead. + +## Screenshots +If applicable, add screenshots to help explain your problem. + +## Error log +**Note: Debug DLL's** +Please replace the current extension DLL's with the debug DLL's (if these are available with the release) and reproduce the error with the debug DLL's before pasting the error log. + +Paste the error log that is related to this issue. + +## Additional context +Add any other context about the problem here. diff --git a/.github/ISSUE_TEMPLATE/feature-request.md b/.github/ISSUE_TEMPLATE/feature-request.md new file mode 100644 index 0000000..3b0943d --- /dev/null +++ b/.github/ISSUE_TEMPLATE/feature-request.md @@ -0,0 +1,33 @@ +--- +name: Feature Request +about: Suggest an idea for this project + +--- + +## Sponsorship + + +If this request requires additional support (e.g., such as direct email/phone/meeting/development), I have the following interest in helping to [sponsor the effort via GitHub Sponsors](https://github.com/sponsors/UpendoVentures): + +- [ ] None, please continute to work for me for free :P +- [ ] Absolutely, I get value out of this! +- [ ] Maybe later +- [ ] I'm already a sponsor... Woot! + +## Is your feature request related to a problem? +**Please describe.** +A clear and concise description of what the problem is. Ex. I'm always frustrated when [...] + +## Describe the solution you'd like +A clear and concise description of what you want to happen. + +## Describe alternatives you've considered +A clear and concise description of any alternative solutions or features you've considered. + +## Additional context +Add any other context or screenshots about the feature request here. diff --git a/.github/ISSUE_TEMPLATE/help-and-other-questions.md b/.github/ISSUE_TEMPLATE/help-and-other-questions.md new file mode 100644 index 0000000..3fe222a --- /dev/null +++ b/.github/ISSUE_TEMPLATE/help-and-other-questions.md @@ -0,0 +1,31 @@ +--- +name: Help and Other Questions +about: Use this to ask questions that don't relate to features and bug reports + +--- + +## Sponsorship + + +If this request requires additional support (e.g., such as direct email/phone/meeting/development), I have the following interest in helping to [sponsor the effort via GitHub Sponsors](https://github.com/sponsors/UpendoVentures): + +- [ ] None, please continute to work for me for free :P +- [ ] Absolutely, I get value out of this! +- [ ] Maybe later +- [ ] I'm already a sponsor... Woot! + +## Please summarize your question in one sentence + + +## Give a more extended description + + +## Steps to reproduce (if needed) + + +## Other comments or remarks diff --git a/.github/PULL_REQUEST_TEMPLATE.md b/.github/PULL_REQUEST_TEMPLATE.md new file mode 100644 index 0000000..fdbbb45 --- /dev/null +++ b/.github/PULL_REQUEST_TEMPLATE.md @@ -0,0 +1,26 @@ + +## Related to Issue +Fixes # + +## Description + + +## How Has This Been Tested? + + + + +## Screenshots (if appropriate): + +## Types of changes + +- [ ] Bug fix (non-breaking change which fixes an issue) +- [ ] New feature (non-breaking change which adds functionality) +- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected) + +## Checklist: + + +- [ ] My code follows the code style of this project. +- [ ] My change requires a change to the documentation. +- [ ] I have updated the documentation accordingly. \ No newline at end of file diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..8d30edc --- /dev/null +++ b/.gitignore @@ -0,0 +1,223 @@ +# Created by http://www.gitignore.io + +### VisualStudio ### +## Ignore Visual Studio temporary files, build results, and +## files generated by popular Visual Studio add-ons. + +# 2015 +.vs/ + +# User-specific files +*.suo +*.user +*.sln.docstates + +# Build results +[Dd]ebug/ +[Dd]ebugPublic/ +[Rr]elease/ +[Rr]eleases/ +x64/ +x86/ +#build/ +bld/ +[Bb]in/ +[Oo]bj/ + +# Cleanup project results +*.[Ff]ile[Ll]ist[Aa]bsolute.txt + +# Roslyn cache directories +*.ide/ + +# MSTest test Results +[Tt]est[Rr]esult*/ +[Bb]uild[Ll]og.* + +#NUNIT +*.VisualState.xml +TestResult.xml + +# Build Results of an ATL Project +[Dd]ebugPS/ +[Rr]eleasePS/ +dlldata.c + +*_i.c +*_p.c +*_i.h +*.ilk +*.meta +*.obj +*.pch +*.pdb +*.pgc +*.pgd +*.rsp +*.sbr +*.tlb +*.tli +*.tlh +*.tmp +*.tmp_proj +*.log +*.vspscc +*.vssscc +.builds +*.pidb +*.svclog +*.scc + +# Chutzpah Test files +_Chutzpah* + +# Visual C++ cache files +ipch/ +*.aps +*.ncb +*.opensdf +*.sdf +*.cachefile + +# Visual Studio profiler +*.psess +*.vsp +*.vspx + +# TFS 2012 Local Workspace +$tf/ + +# Guidance Automation Toolkit +*.gpState + +# ReSharper is a .NET coding add-in +_ReSharper*/ +*.[Rr]e[Ss]harper +*.DotSettings.user + +# JustCode is a .NET coding addin-in +.JustCode + +# TeamCity is a build add-in +_TeamCity* + +# DotCover is a Code Coverage Tool +*.dotCover + +# NCrunch +_NCrunch_* +.*crunch*.local.xml + +# MightyMoose +*.mm.* +AutoTest.Net/ + +#GhostDoc +*.[Gg]host[Dd]oc.xml + +# Web workbench (sass) +.sass-cache/ + +# Installshield output folder +[Ee]xpress/ + +# DocProject is a documentation generator add-in +DocProject/buildhelp/ +DocProject/Help/*.HxT +DocProject/Help/*.HxC +DocProject/Help/*.hhc +DocProject/Help/*.hhk +DocProject/Help/*.hhp +DocProject/Help/Html2 +DocProject/Help/html + +# Click-Once directory +publish/ + +# Publish Web Output +*.[Pp]ublish.xml +*.azurePubxml +# TODO: Comment the next line if you want to checkin your web deploy settings +# but database connection strings (with potential passwords) will be unencrypted +*.pubxml +*.publishproj + +# NuGet Packages +*.nupkg +# The packages folder can be ignored because of Package Restore +**/packages/* +# except build/, which is used as an MSBuild target. +!**/packages/build/ +# If using the old MSBuild-Integrated Package Restore, uncomment this: +#!**/packages/repositories.config + +# Windows Azure Build Output +csx/ +*.build.csdef + +# Windows Store app package directory +AppPackages/ + +# Others +sql/ +*.Cache +ClientBin/ +[Ss]tyle[Cc]op.* +~$* +*~ +*.dbmdl +*.dbproj.schemaview +*.pfx +*.publishsettings +node_modules/ + +# RIA/Silverlight projects +Generated_Code/ + +# Backup & report files from converting an old project file +# to a newer Visual Studio version. Backup files are not needed, +# because we have git ;-) +_UpgradeReport_Files/ +Backup*/ +UpgradeLog*.XML +UpgradeLog*.htm + +# SQL Server files +*.mdf +*.ldf + +# Business Intelligence projects +*.rdl.data +*.bim.layout +*.bim_*.settings + +# Microsoft Fakes +FakesAssemblies/ + + +### Windows ### +# Windows image file caches +Thumbs.db +ehthumbs.db + +# Folder config file +Desktop.ini + +# Recycle Bin used on file shares +$RECYCLE.BIN/ + +# Windows Installer files +*.cab +*.msi +*.msm +*.msp + +# DNN website +[Ww]ebsite/ + +# DNN Lucene.net index files +[Ww]ebsite/[Aa]pp_[Dd]ata/[Ss]earch/ + +# DNN Logs +[Ww]ebsite/[Pp]ortals/_default/[Ll]ogs/ +/MSBuildLog.txt diff --git a/Build/DotNetNuke.MSBuild.Tasks.dll b/Build/DotNetNuke.MSBuild.Tasks.dll new file mode 100644 index 0000000..ec20a03 Binary files /dev/null and b/Build/DotNetNuke.MSBuild.Tasks.dll differ diff --git a/Build/HccViewsetPackage.targets b/Build/HccViewsetPackage.targets new file mode 100644 index 0000000..7c7361e --- /dev/null +++ b/Build/HccViewsetPackage.targets @@ -0,0 +1,62 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/ICSharpCode.SharpZipLib.dll b/Build/ICSharpCode.SharpZipLib.dll new file mode 100644 index 0000000..77bafe8 Binary files /dev/null and b/Build/ICSharpCode.SharpZipLib.dll differ diff --git a/Build/LibraryPackage.targets b/Build/LibraryPackage.targets new file mode 100644 index 0000000..acc55a7 --- /dev/null +++ b/Build/LibraryPackage.targets @@ -0,0 +1,100 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/MSBuild.Community.Tasks.Targets b/Build/MSBuild.Community.Tasks.Targets new file mode 100644 index 0000000..91d0202 --- /dev/null +++ b/Build/MSBuild.Community.Tasks.Targets @@ -0,0 +1,104 @@ + + + + + + $(MSBuildProjectDirectory)\..\..\..\..\BuildScripts + $(BuildScriptsPath)\MSBuild.Community.Tasks.dll + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/MSBuild.Community.Tasks.dll b/Build/MSBuild.Community.Tasks.dll new file mode 100644 index 0000000..cf847a5 Binary files /dev/null and b/Build/MSBuild.Community.Tasks.dll differ diff --git a/Build/ModulePackage.targets b/Build/ModulePackage.targets new file mode 100644 index 0000000..3e736a6 --- /dev/null +++ b/Build/ModulePackage.targets @@ -0,0 +1,148 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/Build/SkinPackage.targets b/Build/SkinPackage.targets new file mode 100644 index 0000000..72c6697 --- /dev/null +++ b/Build/SkinPackage.targets @@ -0,0 +1,98 @@ + + + + + + + + + + + Containers + Skins + $(MSBuildProjectDirectory)\SkinPackageTemp\ + $(MSBuildProjectDirectory)\SkinPackageContainerTemp\ + $(MSBuildProjectDirectory)\SkinPackageSkinTemp\ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Build/SolutionReferences.targets b/Build/SolutionReferences.targets new file mode 100644 index 0000000..72b67e3 --- /dev/null +++ b/Build/SolutionReferences.targets @@ -0,0 +1,31 @@ + + + + + 09.09.00 + 03.06.00 + ..\..\References + $(ReferencesPath)\DNN\$(DnnVersion) + $(ReferencesPath)\HotcakesCommerce\$(HccVersion) + + diff --git a/Components/FeatureController.cs b/Components/FeatureController.cs deleted file mode 100644 index 720774d..0000000 --- a/Components/FeatureController.cs +++ /dev/null @@ -1,12 +0,0 @@ - -using System.Collections.Generic; -using DotNetNuke.Entities.Modules; -using DotNetNuke.Services.Search; - -namespace Upendo.Modules.UserManager.Components -{ - public class UserManagerController - { - - } -} \ No newline at end of file diff --git a/Controllers/RolesManageController.cs b/Controllers/RolesManageController.cs deleted file mode 100644 index 7c0d01c..0000000 --- a/Controllers/RolesManageController.cs +++ /dev/null @@ -1,72 +0,0 @@ - -using DotNetNuke.Entities.Users; -using DotNetNuke.Framework.JavaScriptLibraries; -using DotNetNuke.Security.Roles; -using DotNetNuke.Web.Mvc.Framework.ActionFilters; -using DotNetNuke.Web.Mvc.Framework.Controllers; -using System; -using System.Collections.Generic; -using System.Web.Mvc; -using Upendo.Modules.UserManager.Models.DnnModel; -using Upendo.Modules.UserManager.Utility; -using Upendo.Modules.UserManager.ViewModels; - -namespace Upendo.Modules.UserManager.Controllers -{ - [DnnHandleError] - public class RolesManageController : DnnController - { - [ModuleAction(ControlKey = "Edit", TitleKey = "AddItem")] - public ActionResult Index(double? take, int? pageIndex, string filter, int? goToPage, string search, string orderBy, string order) - { - double takeValue = take == null ? default : take.Value; - int pageIndexValue = take == null ? default : pageIndex.Value; - var portalId = ModuleContext.PortalId; - ViewBag.Filter = filter; - var result = RolesRepository.GetRoles(takeValue, pageIndexValue, filter, goToPage, portalId, search, orderBy, order); - return View(result); - } - - public ActionResult Create() - { - DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); - var portalId = ModuleContext.PortalId; - ViewBag.RoleGroups = RolesRepository.GetRoleGroups(portalId); - return View(); - } - - [HttpPost] - public ActionResult Create(RolesViewModel item) - { - RolesRepository.CreateRol(item); - return RedirectToAction("Index"); - } - - public ActionResult Edit(int itemId) - { - var portalId = ModuleContext.PortalId; - ViewBag.RoleGroups = RolesRepository.GetRoleGroups(portalId); - var item = RolesRepository.GetRole(portalId, itemId); - return View(item); - } - - [HttpPost] - public ActionResult Edit(RolesViewModel item) - { - RolesRepository.EditRol(item); - return RedirectToAction("Index"); - } - public ActionResult Details(int itemId) - { - var portalId = ModuleContext.PortalId; - var item = RolesRepository.GetRole(portalId, itemId); - return View(item); - } - public ActionResult Delete(int itemId) - { - var portalId = ModuleContext.PortalId; - RolesRepository.DeleteRol(itemId, portalId); - return RedirectToAction("Index"); - } - } -} diff --git a/Controllers/SettingsController.cs b/Controllers/SettingsController.cs deleted file mode 100644 index 7903f10..0000000 --- a/Controllers/SettingsController.cs +++ /dev/null @@ -1,46 +0,0 @@ - -using DotNetNuke.Collections; -using DotNetNuke.Security; -using DotNetNuke.Web.Mvc.Framework.ActionFilters; -using DotNetNuke.Web.Mvc.Framework.Controllers; -using System.Web.Mvc; - -namespace Upendo.Modules.UserManager.Controllers -{ - [DnnModuleAuthorize(AccessLevel = SecurityAccessLevel.Edit)] - [DnnHandleError] - public class SettingsController : DnnController - { - /// - /// - /// - /// - [HttpGet] - public ActionResult Settings() - { - var settings = new Models.Settings(); - settings.Setting1 = ModuleContext.Configuration.ModuleSettings.GetValueOrDefault("Upendo.Modules.UserManager_Setting1", false); - settings.Setting2 = ModuleContext.Configuration.ModuleSettings.GetValueOrDefault("Upendo.Modules.UserManager_Setting2", System.DateTime.Now); - - return View(settings); - } - - /// - /// - /// - /// - /// - [HttpPost] - [ValidateInput(false)] - [DotNetNuke.Web.Mvc.Framework.ActionFilters.ValidateAntiForgeryToken] - public ActionResult Settings(Models.Settings settings) - { - var security = new PortalSecurity(); - - ModuleContext.Configuration.ModuleSettings["Upendo.Modules.UserManager_Setting1"] = security.InputFilter(settings.Setting1.ToString().Trim(), PortalSecurity.FilterFlag.NoMarkup); - ModuleContext.Configuration.ModuleSettings["Upendo.Modules.UserManager_Setting2"] = security.InputFilter(settings.Setting2.ToUniversalTime().ToString("u"), PortalSecurity.FilterFlag.NoMarkup); - - return RedirectToDefaultRoute(); - } - } -} \ No newline at end of file diff --git a/Controllers/UserManageController.cs b/Controllers/UserManageController.cs deleted file mode 100644 index 3598644..0000000 --- a/Controllers/UserManageController.cs +++ /dev/null @@ -1,184 +0,0 @@ - -using DotNetNuke.Entities.Users; -using DotNetNuke.Framework.JavaScriptLibraries; -using DotNetNuke.Security.Roles; -using DotNetNuke.Web.Mvc.Framework.ActionFilters; -using DotNetNuke.Web.Mvc.Framework.Controllers; -using System; -using System.Collections.Generic; -using System.Web.Mvc; -using Upendo.Modules.UserManager.Models.DnnModel; -using Upendo.Modules.UserManager.Utility; -using Upendo.Modules.UserManager.Utility; -using Upendo.Modules.UserManager.ViewModels; - -namespace Upendo.Modules.UserManager.Controllers -{ - [DnnHandleError] - public class UserManageController : DnnController - { - [ModuleAction(ControlKey = "Edit", TitleKey = "AddItem")] - public ActionResult Index(double? take, int? pageIndex, string filter, int? goToPage, string search, string orderBy, string order) - { - var takeValue = take ?? default; - var pageIndexValue = take == null ? default : pageIndex.Value; - var portalId = ModuleContext.PortalId; - var portalSettings = ModuleContext.PortalSettings; - string serverUrl = $"{Request.Url.Scheme}://{portalSettings.PortalAlias.HTTPAlias}"; - switch (filter) - { - case "8": - ViewBag.Filter = "All"; - break; - case "0": - ViewBag.Filter = "Authorized"; - break; - case "1": - ViewBag.Filter = "Unauthorized"; - break; - case "2": - ViewBag.Filter = "Deleted"; - break; - case "3": - ViewBag.Filter = "SuperUsers"; - break; - default: - filter = "0"; - ViewBag.Filter = "Authorized"; - break; - } - var pagination = new Pagination() - { - Take = takeValue, - PageIndex = pageIndexValue, - Filter = filter, - GoToPage = goToPage, - PortalId = portalId, - Search = search, - OrderBy = orderBy, - Order = order, - ServerUrl = serverUrl, - }; - var result = UserRepository.GetUsers(pagination); - return View(result); - } - - public ActionResult Create() - { - DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); - return View(); - } - - [HttpPost] - public ActionResult Create(UserViewModel item) - { - var portalId = ModuleContext.PortalId; - var user = UserController.GetUserByName(portalId, item.Username); - - if (user != null) - { - ModelState.AddModelError(string.Empty, @"The username is already in use."); - ModelState.Remove("UserId"); - return View(item); - } - var isValidUserName = UserController.Instance.IsValidUserName(item.Username); - if (isValidUserName) - { - ModelState.AddModelError(string.Empty, @"The username is not valid"); - return View(item); - } - if (!ModelState.IsValid) - { - return View(item); - } - //var portalId = PortalController.Instance.GetCurrentPortalSettings().PortalId; - UserRepository.CreateUser(item, portalId); - return RedirectToAction("Index"); - } - - public ActionResult Edit(int itemId) - { - var portalId = ModuleContext.PortalId; - var item = UserRepository.GetUser(portalId, itemId); - return View(item); - } - - [HttpPost] - public ActionResult Edit(UserViewModel item) - { - //int editedFor = User.UserID; - var portalId = ModuleContext.PortalId; - UserRepository.EditUser(portalId, item); - return RedirectToDefaultRoute(); - } - public ActionResult Details(int itemId) - { - DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); - var portalId = ModuleContext.PortalId; - var item = UserRepository.GetUser(portalId, itemId); - return View(item); - } - public ActionResult Delete(int itemId) - { - var portalId = ModuleContext.PortalId; - UserRepository.DeleteUser(portalId,itemId); - return RedirectToDefaultRoute(); - } - public ActionResult ChangePassword(int itemId) - { - DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); - var portalId = ModuleContext.PortalId; - var item = UserRepository.GetUser(portalId, itemId); - return View(item); - } - - [HttpPost] - public ActionResult ChangePassword(UserViewModel user) - { - var portalId = ModuleContext.PortalId; - - if (user.Password.Equals(user.ConfirmPassword)) - { - UserRepository.ChangePassword(portalId,user.UserId, user.Password); - } - return RedirectToDefaultRoute(); - } - public ActionResult DeleteUnauthorizedUsers() - { - var portalId = ModuleContext.PortalId; - UserController.DeleteUnauthorizedUsers(portalId); - return RedirectToDefaultRoute(); - } - public ActionResult RemoveDeletedUsers() - { - var portalId = ModuleContext.PortalId; - UserController.RemoveDeletedUsers(portalId); - return RedirectToDefaultRoute(); - } - - public ActionResult UserRoles(double? take, int? pageIndex, int? goToPage, string search, int itemId, int? roleId, string actionView) - { - double takeValue = take == null ? default : take.Value; - int pageIndexValue = take == null ? default : pageIndex.Value; - int roleIdValue = roleId == null ? default : roleId.Value; - - var portalId = ModuleContext.PortalId; - - if (roleId != null) - { - if (actionView == "Add") - { - RoleController.Instance.AddUserRole(portalId, itemId, roleIdValue, RoleStatus.Approved, false, DateTime.Now, DateTime.Now.AddDays(30)); - - } - else - { - RoleController.Instance.UpdateUserRole(portalId, itemId, roleIdValue, RoleStatus.Approved, false, true); - } - } - ViewBag.User = UserRepository.GetUser(portalId, itemId); - var result = UserRepository.GetRolesByUser(takeValue, pageIndexValue, goToPage, portalId, search, itemId); - return View(result); - } - } -} diff --git a/Directory.Packages.props b/Directory.Packages.props new file mode 100644 index 0000000..b144383 --- /dev/null +++ b/Directory.Packages.props @@ -0,0 +1,14 @@ + + + + + + + + + + + + + + diff --git a/LICENSE b/LICENSE deleted file mode 100644 index 43744dc..0000000 --- a/LICENSE +++ /dev/null @@ -1,21 +0,0 @@ -MIT License - -Copyright (c) 2023 Upendo Ventures, LLC - -Permission is hereby granted, free of charge, to any person obtaining a copy -of this software and associated documentation files (the "Software"), to deal -in the Software without restriction, including without limitation the rights -to use, copy, modify, merge, publish, distribute, sublicense, and/or sell -copies of the Software, and to permit persons to whom the Software is -furnished to do so, subject to the following conditions: - -The above copyright notice and this permission notice shall be included in all -copies or substantial portions of the Software. - -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR -IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, -FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE -AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER -LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, -OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE -SOFTWARE. diff --git a/License.txt b/License.txt deleted file mode 100644 index 410bdba..0000000 --- a/License.txt +++ /dev/null @@ -1,3 +0,0 @@ -

UserManager Modules Extension for DNN

-

Upendo https://upendoventures.com/

-

Your License Here

\ No newline at end of file diff --git a/Models/DnnModel/AspnetApplications.cs b/Models/DnnModel/AspnetApplications.cs deleted file mode 100644 index f11b665..0000000 --- a/Models/DnnModel/AspnetApplications.cs +++ /dev/null @@ -1,19 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Upendo.Modules.UserManager.Models.DnnModel -{ - public partial class AspnetApplications - { - - public string ApplicationName { get; set; } - public string LoweredApplicationName { get; set; } - [Key] - public Guid ApplicationId { get; set; } - public string Description { get; set; } - - - - } -} diff --git a/Models/DnnModel/AspnetUsers.cs b/Models/DnnModel/AspnetUsers.cs deleted file mode 100644 index 4f0e0eb..0000000 --- a/Models/DnnModel/AspnetUsers.cs +++ /dev/null @@ -1,21 +0,0 @@ -//using System; -//using System.Collections.Generic; -//using System.ComponentModel.DataAnnotations; -//using System.ComponentModel.DataAnnotations.Schema; - -//namespace Upendo.Modules.UserManager.Models.DnnModel -//{ -// public partial class AspnetUsers -// { -// [ForeignKey("ApplicationId")] -// public Guid ApplicationId { get; set; } -// [Key] -// public Guid UserId { get; set; } -// public string UserName { get; set; } -// public string LoweredUserName { get; set; } -// public string MobileAlias { get; set; } -// public bool IsAnonymous { get; set; } -// public DateTime LastActivityDate { get; set; } - -// } -//} diff --git a/Models/DnnModel/RoleGroups.cs b/Models/DnnModel/RoleGroups.cs deleted file mode 100644 index 7ad5e6a..0000000 --- a/Models/DnnModel/RoleGroups.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Upendo.Modules.UserManager.Models.DnnModel -{ - public partial class RoleGroups - { - public RoleGroups() - { - Roles = new HashSet(); - } - [Key] - public int RoleGroupId { get; set; } - public int PortalId { get; set; } - public string RoleGroupName { get; set; } - public string Description { get; set; } - public int? CreatedByUserId { get; set; } - public DateTime? CreatedOnDate { get; set; } - public int? LastModifiedByUserId { get; set; } - public DateTime? LastModifiedOnDate { get; set; } - - public virtual Portals Portal { get; set; } - public virtual ICollection Roles { get; set; } - } -} diff --git a/Models/DnnModel/UserRoles.cs b/Models/DnnModel/UserRoles.cs deleted file mode 100644 index 1b0bdc4..0000000 --- a/Models/DnnModel/UserRoles.cs +++ /dev/null @@ -1,26 +0,0 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel.DataAnnotations; - -namespace Upendo.Modules.UserManager.Models.DnnModel -{ - public partial class UserRoles - { - [Key] - public int UserRoleId { get; set; } - public int UserId { get; set; } - public int RoleId { get; set; } - public DateTime? ExpiryDate { get; set; } - public bool? IsTrialUsed { get; set; } - public DateTime? EffectiveDate { get; set; } - public int? CreatedByUserId { get; set; } - public DateTime? CreatedOnDate { get; set; } - public int? LastModifiedByUserId { get; set; } - public DateTime? LastModifiedOnDate { get; set; } - public int Status { get; set; } - public bool IsOwner { get; set; } - - public virtual Roles Role { get; set; } - public virtual Users User { get; set; } - } -} diff --git a/Models/Interfaces/IExampleInfo.cs b/Models/Interfaces/IExampleInfo.cs deleted file mode 100644 index 0d87411..0000000 --- a/Models/Interfaces/IExampleInfo.cs +++ /dev/null @@ -1,17 +0,0 @@ - -using System; - -namespace Upendo.Modules.UserManager.Models -{ - public interface IExampleInfo - { - int ExampleId { get; set; } - int ModuleId { get; set; } - string Title { get; set; } - string Description { get; set; } - int CreatedByUserId { get; set; } - DateTime CreatedOnDate { get; set; } - int LastUpdatedByUserId { get; set; } - DateTime LastUpdatedOnDate { get; set; } - } -} \ No newline at end of file diff --git a/Models/Settings.cs b/Models/Settings.cs deleted file mode 100644 index 954de02..0000000 --- a/Models/Settings.cs +++ /dev/null @@ -1,14 +0,0 @@ - -using System; -using System.Collections.Generic; -using System.Linq; -using System.Web; - -namespace Upendo.Modules.UserManager.Models -{ - public class Settings - { - public bool Setting1 { get; set; } - public DateTime Setting2 { get; set; } - } -} \ No newline at end of file diff --git a/Modules/UserManager/App_LocalResources/AddEdit.resx b/Modules/UserManager/App_LocalResources/AddEdit.resx new file mode 100644 index 0000000..1f8dd5d --- /dev/null +++ b/Modules/UserManager/App_LocalResources/AddEdit.resx @@ -0,0 +1,210 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ACCOUNT DATA + + + ACCOUNT SETTINGS + + + Approved + + + Cancel + + + Confirm Password + + + Created Date: + + + Create User + + + Display Name: + + + Email + + + fair + + + First Name + + + Invalid email address. + + + IsDeleted + + + IsSuperUser + + + Last Activity Date: + + + Last Name + + + Match + + + New Password + + + Password + + + Password and Confirmation Password must match. + + + Save + + + Send An Email To New User + + + strong + + + Update Password: + + + User ID: + + + Username + + + User Role Management + + + User Roles + + + Valid email address. + + + weak + + \ No newline at end of file diff --git a/Modules/UserManager/App_LocalResources/AddEditRoles.resx b/Modules/UserManager/App_LocalResources/AddEditRoles.resx new file mode 100644 index 0000000..94ab756 --- /dev/null +++ b/Modules/UserManager/App_LocalResources/AddEditRoles.resx @@ -0,0 +1,141 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Automatically Assign Role + + + Description + + + Public Role? + + + Role Group + + + Role Name + + + Save + + + Status + + \ No newline at end of file diff --git a/App_LocalResources/Example.resx b/Modules/UserManager/App_LocalResources/Example.resx similarity index 100% rename from App_LocalResources/Example.resx rename to Modules/UserManager/App_LocalResources/Example.resx diff --git a/Modules/UserManager/App_LocalResources/FeatureController.resx b/Modules/UserManager/App_LocalResources/FeatureController.resx new file mode 100644 index 0000000..21f889e --- /dev/null +++ b/Modules/UserManager/App_LocalResources/FeatureController.resx @@ -0,0 +1,126 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Edit Users + + + Upgrade IUpgradeable successful + + diff --git a/Modules/UserManager/App_LocalResources/Index.resx b/Modules/UserManager/App_LocalResources/Index.resx new file mode 100644 index 0000000..2e84e3e --- /dev/null +++ b/Modules/UserManager/App_LocalResources/Index.resx @@ -0,0 +1,192 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ACTIONS + + + AUTO + + + Create User + + + Create Role + + + Are you sure you want to delete this user? + + + Are you sure you want to delete this role? + + + Are you sure you want to delete unauthorized users? + + + Delete Unauthorized Users + + + Display Name + + + Email + + + Id + + + No users found + + + Do you wish to permanently remove deleted users? You cannot undo this operation. + + + Remove Delete Users + + + ROLE NAME + + + Roles List + + + Rows Per Page: + + + with this search criteria + + + Sort By + + + Superuser? + + + User List + + + Username + + + User Roles + + + USERS + + \ No newline at end of file diff --git a/Modules/UserManager/App_LocalResources/RolesManageController.resx b/Modules/UserManager/App_LocalResources/RolesManageController.resx new file mode 100644 index 0000000..28997c1 --- /dev/null +++ b/Modules/UserManager/App_LocalResources/RolesManageController.resx @@ -0,0 +1,129 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + Approved + + + Disabled + + + Pending + + \ No newline at end of file diff --git a/Modules/UserManager/App_LocalResources/Shared.resx b/Modules/UserManager/App_LocalResources/Shared.resx new file mode 100644 index 0000000..2152a48 --- /dev/null +++ b/Modules/UserManager/App_LocalResources/Shared.resx @@ -0,0 +1,177 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + All + + + Authorized + + + Deleted + + + Unauthorized + + + Records + + + Go To Page: + + + of + + + Page + + + Pages + + + Rows Per Page: + + + Search + + + Showing + + + Sort By + + + Superusers + + + to + + + Edit + + + Next + + + Previous + + + Editing Site Roles + + \ No newline at end of file diff --git a/App_LocalResources/Settings.resx b/Modules/UserManager/App_LocalResources/UserManageController.resx similarity index 90% rename from App_LocalResources/Settings.resx rename to Modules/UserManager/App_LocalResources/UserManageController.resx index be454b7..e042215 100644 --- a/App_LocalResources/Settings.resx +++ b/Modules/UserManager/App_LocalResources/UserManageController.resx @@ -117,22 +117,10 @@ System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 - - UserManager Item Basic Settings + + You do not have the necessary security permissions to use this application. - - UserManager Settings - - - Setting One - - - Put your value for Setting 1 here. - - - Setting Two - - - Put your value for Setting 2 here. + + The username is already in use. \ No newline at end of file diff --git a/Modules/UserManager/App_LocalResources/UserRoles.resx b/Modules/UserManager/App_LocalResources/UserRoles.resx new file mode 100644 index 0000000..9a0aef0 --- /dev/null +++ b/Modules/UserManager/App_LocalResources/UserRoles.resx @@ -0,0 +1,144 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + text/microsoft-resx + + + 2.0 + + + System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089 + + + ACTIONS + + + Add Role + + + Delete + + + No roles founds + + + ROLE + + + Editing Roles For: + + + with this search criteria + + + User List + + \ No newline at end of file diff --git a/Modules/UserManager/Components/FeatureController.cs b/Modules/UserManager/Components/FeatureController.cs new file mode 100644 index 0000000..34013d1 --- /dev/null +++ b/Modules/UserManager/Components/FeatureController.cs @@ -0,0 +1,62 @@ +/* +Copyright Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System.Collections.Generic; +using DotNetNuke.Entities.Modules; +using DotNetNuke.Services.Search; +using DotNetNuke.Entities.Modules.Definitions; +using DotNetNuke.Security.Permissions; +using DotNetNuke.Services.Localization; + +namespace Upendo.Modules.UserManager.Components +{ + public class UserManagerController : IUpgradeable + { + private readonly string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/FeatureController.resx"; + + public string UpgradeModule(string Version) + { + switch (Version) + { + case "01.00.00": + InitModulePermissions(); + break; + } + return Localization.GetString("UpgradeSuccessful.Text", ResourceFile); + } + private void InitModulePermissions() + { + PermissionController permCtl = new PermissionController(); + DesktopModuleInfo desktopInfo = DesktopModuleController.GetDesktopModuleByModuleName("Upendo DNN User Manager", 0); + ModuleDefinitionInfo modDefInfo = ModuleDefinitionController.GetModuleDefinitionByFriendlyName("Upendo DNN User Manager", desktopInfo.DesktopModuleID); + try + { + PermissionInfo pi = new PermissionInfo + { + ModuleDefID = modDefInfo.ModuleDefID, + PermissionCode = "SECURITY_MODULE", + PermissionKey = "EDIT", + PermissionName = Localization.GetString("EditUser.Text", ResourceFile) + }; + permCtl.AddPermission(pi); + } + catch { } + } + } +} \ No newline at end of file diff --git a/Modules/UserManager/Controllers/RolesManageController.cs b/Modules/UserManager/Controllers/RolesManageController.cs new file mode 100644 index 0000000..0b4cc16 --- /dev/null +++ b/Modules/UserManager/Controllers/RolesManageController.cs @@ -0,0 +1,114 @@ +/* +Copyright Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using DotNetNuke.Framework.JavaScriptLibraries; +using DotNetNuke.Services.Localization; +using DotNetNuke.Web.Mvc.Framework.ActionFilters; +using DotNetNuke.Web.Mvc.Framework.Controllers; +using System.Collections.Generic; +using System.Web.Mvc; +using Upendo.Modules.UserManager.Utility; +using Upendo.Modules.UserManager.ViewModels; + +namespace Upendo.Modules.UserManager.Controllers +{ + [DnnHandleError] + public class RolesManageController : DnnController + { + private readonly string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/UserManageController.resx"; + + public RolesManageController() + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + } + + [ModuleAction(ControlKey = "Edit", TitleKey = "AddItem")] + public ActionResult Index(double? take, int? pageIndex, string filter, int? goToPage, string search, string orderBy, string order) + { + // Check if the user is authenticated + bool isAuthenticated = Request.IsAuthenticated; + // Check if the authenticated user has the required permission + var hasPermission = Functions.HasPermission(ModuleContext); + + // Check if the user is authenticated and has the required permission + if (!isAuthenticated || !hasPermission) + { + string errorMessage = Localization.GetString("NotPermissions.Text", ResourceFile); + ViewBag.ErrorMessage = errorMessage; + return View("Error"); + } + else + { + double takeValue = take == null ? default : take.Value; + int pageIndexValue = take == null ? default : pageIndex.Value; + var portalId = ModuleContext.PortalId; + ViewBag.Filter = filter; + var result = RolesRepository.GetRoles(takeValue, pageIndexValue, filter, goToPage, portalId, search, orderBy, order); + return View(result); + } + + } + + public ActionResult Create() + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + ViewBag.RoleGroups = RolesRepository.GetRoleGroups(portalId); + ViewBag.StatusList = RolesRepository.StatusList(); + return View(); + } + + [HttpPost] + public ActionResult Create(RolesViewModel item) + { + RolesRepository.CreateRol(item); + return RedirectToAction("Index"); + } + + public ActionResult Edit(int itemId) + { + var portalId = ModuleContext.PortalId; + ViewBag.RoleGroups = RolesRepository.GetRoleGroups(portalId); + ViewBag.StatusList = RolesRepository.StatusList(); + var item = RolesRepository.GetRole(portalId, itemId); + return View(item); + } + + [HttpPost] + public ActionResult Edit(RolesViewModel item) + { + RolesRepository.EditRol(item); + return RedirectToAction("Index"); + } + public ActionResult Details(int itemId) + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + var item = RolesRepository.GetRole(portalId, itemId); + return View(item); + } + public ActionResult Delete(int itemId) + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + RolesRepository.DeleteRol(itemId, portalId); + return RedirectToAction("Index"); + } + } +} diff --git a/Modules/UserManager/Controllers/UserManageController.cs b/Modules/UserManager/Controllers/UserManageController.cs new file mode 100644 index 0000000..31d9068 --- /dev/null +++ b/Modules/UserManager/Controllers/UserManageController.cs @@ -0,0 +1,270 @@ +/* +Copyright Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using DotNetNuke.Entities.Users; +using DotNetNuke.Framework.JavaScriptLibraries; +using DotNetNuke.Security.Permissions; +using DotNetNuke.Security.Roles; +using DotNetNuke.Services.Localization; +using DotNetNuke.Web.Mvc.Framework.ActionFilters; +using DotNetNuke.Web.Mvc.Framework.Controllers; +using System; +using System.Web.Mvc; +using Upendo.Modules.UserManager.Utility; +using Upendo.Modules.UserManager.ViewModels; + +namespace Upendo.Modules.UserManager.Controllers +{ + [DnnHandleError] + public class UserManageController : DnnController + { + private readonly string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/UserManageController.resx"; + private readonly string SharedResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/Shared.resx"; + + public UserManageController() + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + } + [ModuleAction(ControlKey = "Edit", TitleKey = "AddItem")] + public ActionResult Index(double? take, int? pageIndex, string filter, int? goToPage, string search, string orderBy, string order) + { + // Check if the user is authenticated + bool isAuthenticated = Request.IsAuthenticated; + + // Check if the authenticated user has the required permission + var hasPermission = Functions.HasPermission(ModuleContext); + + // Check if the user is authenticated and has the required permission + if (!isAuthenticated || !hasPermission) + { + string errorMessage = Localization.GetString("NotPermissions.Text", ResourceFile); + ViewBag.ErrorMessage = errorMessage; + return View("Error"); + } + else + { + var currentUser = UserController.Instance.GetCurrentUserInfo(); + // Pass the information of whether the current user is a SuperUser to the view + ViewBag.IsCurrentUserSuperUser = currentUser.IsSuperUser; + + var takeValue = take ?? default; + var pageIndexValue = take == null ? default : pageIndex.Value; + var portalId = ModuleContext.PortalId; + switch (filter) + { + case "All": + ViewBag.Filter = Localization.GetString("All", SharedResourceFile); ; + break; + case "Authorized": + ViewBag.Filter = Localization.GetString("Authorized", SharedResourceFile); + break; + case "Unauthorized": + ViewBag.Filter = Localization.GetString("Unauthorized", SharedResourceFile); + break; + case "Deleted": + ViewBag.Filter = Localization.GetString("Deleted", SharedResourceFile); + break; + case "SuperUsers": + // Determine the appropriate filter value based on whether the current user is a SuperUser + filter = currentUser.IsSuperUser ? "SuperUsers" : "Authorized"; + + // Set the ViewBag.Filter message based on whether the current user is a SuperUser + ViewBag.Filter = currentUser.IsSuperUser + ? Localization.GetString("SuperUsers", SharedResourceFile) + : Localization.GetString("Authorized", SharedResourceFile); + break; + default: + filter = "Authorized"; + ViewBag.Filter = Localization.GetString("Authorized", SharedResourceFile); + break; + } + var pagination = new Pagination() + { + Take = takeValue, + PageIndex = pageIndexValue, + Filter = filter, + GoToPage = goToPage, + PortalId = portalId, + Search = search, + OrderBy = orderBy, + Order = order, + ServerUrl = "", + }; + var result = UserRepository.GetUsers(pagination, portalId); + return View(result); + } + } + + public ActionResult Create() + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + return View(); + } + + [HttpPost] + public ActionResult Create(UserViewModel item) + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + var user = UserController.GetUserByName(portalId, item.Username); + ModelState.Remove("UserId"); + if (user != null) + { + string errorMessage = Localization.GetString("UsernameInUse.Text", ResourceFile); + ModelState.AddModelError(string.Empty, @errorMessage); + return View(item); + } + + if (!ModelState.IsValid) + { + return View(item); + } + UserRepository.CreateUser(item, portalId); + return RedirectToAction("Index"); + } + + public ActionResult Edit(int itemId) + { + var portalId = ModuleContext.PortalId; + var item = UserRepository.GetUser(portalId, itemId); + + // Get the current authenticated user + var currentUser = UserController.Instance.GetCurrentUserInfo(); + ViewBag.IsCurrentUserSuperUser = currentUser.IsSuperUser; + ViewBag.OwnProfile = currentUser.UserID != itemId ? false : currentUser.IsSuperUser ? false : true; + return View(item); + } + + [HttpPost] + public ActionResult Edit(UserViewModel item) + { + var currentUser = UserController.Instance.GetCurrentUserInfo(); + var portalId = ModuleContext.PortalId; + if (currentUser.UserID != item.UserId) + { + UserRepository.EditUser(portalId, item); + } + return RedirectToDefaultRoute(); + } + public ActionResult Details(int itemId) + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + + var portalId = ModuleContext.PortalId; + var item = UserRepository.GetUser(portalId, itemId); + return View(item); + } + public ActionResult Delete(int itemId) + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + UserRepository.DeleteUser(portalId, itemId); + return RedirectToDefaultRoute(); + } + public ActionResult ChangePassword(int itemId) + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + var item = UserRepository.GetUser(portalId, itemId); + return View(item); + } + + [HttpPost] + public ActionResult ChangePassword(UserViewModel user) + { + var portalId = ModuleContext.PortalId; + + if (user.Password.Equals(user.ConfirmPassword)) + { + UserRepository.ChangePassword(portalId, user.UserId, user.Password); + } + return RedirectToDefaultRoute(); + } + public ActionResult DeleteUnauthorizedUsers() + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + UserController.DeleteUnauthorizedUsers(portalId); + return RedirectToDefaultRoute(); + } + public ActionResult RemoveDeletedUsers() + { + DotNetNuke.Framework.JavaScriptLibraries.JavaScript.RequestRegistration(CommonJs.DnnPlugins); + var portalId = ModuleContext.PortalId; + UserController.RemoveDeletedUsers(portalId); + return RedirectToDefaultRoute(); + } + + public ActionResult UserRoles(double? take, int? pageIndex, int? goToPage, string search, int itemId, int? roleId, string actionView) + { + bool isAuthenticated = Request.IsAuthenticated; + // Check if the authenticated user has the required permission + var hasPermission = Functions.HasPermission(ModuleContext); + + // Check if the user is authenticated and has the required permission + if (!isAuthenticated || !hasPermission) + { + string errorMessage = Localization.GetString("NotPermissions.Text", ResourceFile); + ViewBag.ErrorMessage = errorMessage; + return View("Error"); + } + else + { + var currentUser = UserController.Instance.GetCurrentUserInfo(); + var ownProfile = currentUser.UserID != itemId ? false : currentUser.IsSuperUser ? false : true; + // Check if it's the user's own profile. If not, or if the user is a superuser, set ownProfile to true. + if (ownProfile) + { + // Redirect to the default route if it's the user's own profile or if the user is a superuser. + return RedirectToDefaultRoute(); + } + double takeValue = take == null ? default : take.Value; + int pageIndexValue = take == null ? default : pageIndex.Value; + int roleIdValue = roleId == null ? default : roleId.Value; + + var portalId = ModuleContext.PortalId; + + bool isAdminOrSuperUser = currentUser.IsSuperUser || currentUser.IsInRole("Administrators"); + var role = RolesRepository.GetRole(portalId, roleIdValue); + // Check if the role is "Administrators" and the user is not an administrator or superuser + if (role.RoleName == "Administrators" && !isAdminOrSuperUser) + { + ViewBag.User = UserRepository.GetUser(portalId, itemId); + var result1 = UserRepository.GetRolesByUser(takeValue, pageIndexValue, goToPage, portalId, search, itemId); + return View(result1); + } + + if (roleId != null) + { + if (actionView == "Add") + { + RoleController.Instance.AddUserRole(portalId, itemId, roleIdValue, RoleStatus.Approved, false, DateTime.Now, DateTime.Now.AddDays(30)); + } + else + { + RoleController.Instance.UpdateUserRole(portalId, itemId, roleIdValue, RoleStatus.Approved, false, true); + } + } + ViewBag.User = UserRepository.GetUser(portalId, itemId); + var result = UserRepository.GetRolesByUser(takeValue, pageIndexValue, goToPage, portalId, search, itemId); + return View(result); + } + } + } +} diff --git a/Images/Upendo-logo-trans.png b/Modules/UserManager/Images/Upendo-logo-trans.png similarity index 100% rename from Images/Upendo-logo-trans.png rename to Modules/UserManager/Images/Upendo-logo-trans.png diff --git a/Images/defaultUserPicture.jpg b/Modules/UserManager/Images/defaultUserPicture.jpg similarity index 100% rename from Images/defaultUserPicture.jpg rename to Modules/UserManager/Images/defaultUserPicture.jpg diff --git a/Images/logo.png b/Modules/UserManager/Images/logo.png similarity index 100% rename from Images/logo.png rename to Modules/UserManager/Images/logo.png diff --git a/Modules/UserManager/License.txt b/Modules/UserManager/License.txt new file mode 100644 index 0000000..d214942 --- /dev/null +++ b/Modules/UserManager/License.txt @@ -0,0 +1,10 @@ +

Upendo DNN User Manager Module for DNN

+

Upendo https://upendoventures.com/What/CMS/DNN

+ +

Copyright (C) Upendo Ventures, LLC

+ +

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

+ +

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

+ +

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

\ No newline at end of file diff --git a/Modules/UserManager/Models/DnnModel/AspnetApplications.cs b/Modules/UserManager/Models/DnnModel/AspnetApplications.cs new file mode 100644 index 0000000..8e01697 --- /dev/null +++ b/Modules/UserManager/Models/DnnModel/AspnetApplications.cs @@ -0,0 +1,38 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Upendo.Modules.UserManager.Models.DnnModel +{ + public partial class AspnetApplications + { + + public string ApplicationName { get; set; } + public string LoweredApplicationName { get; set; } + [Key] + public Guid ApplicationId { get; set; } + public string Description { get; set; } + + + + } +} diff --git a/Models/DnnModel/AspnetMembership.cs b/Modules/UserManager/Models/DnnModel/AspnetMembership.cs similarity index 56% rename from Models/DnnModel/AspnetMembership.cs rename to Modules/UserManager/Models/DnnModel/AspnetMembership.cs index 258d429..f12d2d4 100644 --- a/Models/DnnModel/AspnetMembership.cs +++ b/Modules/UserManager/Models/DnnModel/AspnetMembership.cs @@ -1,4 +1,23 @@ -using System; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using System.ComponentModel.DataAnnotations.Schema; diff --git a/Modules/UserManager/Models/DnnModel/AspnetUsers.cs b/Modules/UserManager/Models/DnnModel/AspnetUsers.cs new file mode 100644 index 0000000..557f569 --- /dev/null +++ b/Modules/UserManager/Models/DnnModel/AspnetUsers.cs @@ -0,0 +1,40 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +//using System; +//using System.Collections.Generic; +//using System.ComponentModel.DataAnnotations; +//using System.ComponentModel.DataAnnotations.Schema; + +//namespace Upendo.Modules.UserManager.Models.DnnModel +//{ +// public partial class AspnetUsers +// { +// [ForeignKey("ApplicationId")] +// public Guid ApplicationId { get; set; } +// [Key] +// public Guid UserId { get; set; } +// public string UserName { get; set; } +// public string LoweredUserName { get; set; } +// public string MobileAlias { get; set; } +// public bool IsAnonymous { get; set; } +// public DateTime LastActivityDate { get; set; } + +// } +//} diff --git a/Models/DnnModel/Portals.cs b/Modules/UserManager/Models/DnnModel/Portals.cs similarity index 61% rename from Models/DnnModel/Portals.cs rename to Modules/UserManager/Models/DnnModel/Portals.cs index 57a9261..4cfea0b 100644 --- a/Models/DnnModel/Portals.cs +++ b/Modules/UserManager/Models/DnnModel/Portals.cs @@ -1,4 +1,23 @@ -using System; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/Modules/UserManager/Models/DnnModel/RoleGroups.cs b/Modules/UserManager/Models/DnnModel/RoleGroups.cs new file mode 100644 index 0000000..241ae4d --- /dev/null +++ b/Modules/UserManager/Models/DnnModel/RoleGroups.cs @@ -0,0 +1,45 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Upendo.Modules.UserManager.Models.DnnModel +{ + public partial class RoleGroups + { + public RoleGroups() + { + Roles = new HashSet(); + } + [Key] + public int RoleGroupId { get; set; } + public int PortalId { get; set; } + public string RoleGroupName { get; set; } + public string Description { get; set; } + public int? CreatedByUserId { get; set; } + public DateTime? CreatedOnDate { get; set; } + public int? LastModifiedByUserId { get; set; } + public DateTime? LastModifiedOnDate { get; set; } + + public virtual Portals Portal { get; set; } + public virtual ICollection Roles { get; set; } + } +} diff --git a/Models/DnnModel/Roles.cs b/Modules/UserManager/Models/DnnModel/Roles.cs similarity index 55% rename from Models/DnnModel/Roles.cs rename to Modules/UserManager/Models/DnnModel/Roles.cs index 6012251..20274de 100644 --- a/Models/DnnModel/Roles.cs +++ b/Modules/UserManager/Models/DnnModel/Roles.cs @@ -1,4 +1,23 @@ -using System; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; diff --git a/Modules/UserManager/Models/DnnModel/UserRoles.cs b/Modules/UserManager/Models/DnnModel/UserRoles.cs new file mode 100644 index 0000000..5f42a5f --- /dev/null +++ b/Modules/UserManager/Models/DnnModel/UserRoles.cs @@ -0,0 +1,45 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; + +namespace Upendo.Modules.UserManager.Models.DnnModel +{ + public partial class UserRoles + { + [Key] + public int UserRoleId { get; set; } + public int UserId { get; set; } + public int RoleId { get; set; } + public DateTime? ExpiryDate { get; set; } + public bool? IsTrialUsed { get; set; } + public DateTime? EffectiveDate { get; set; } + public int? CreatedByUserId { get; set; } + public DateTime? CreatedOnDate { get; set; } + public int? LastModifiedByUserId { get; set; } + public DateTime? LastModifiedOnDate { get; set; } + public int Status { get; set; } + public bool IsOwner { get; set; } + + public virtual Roles Role { get; set; } + public virtual Users User { get; set; } + } +} diff --git a/Models/DnnModel/Users.cs b/Modules/UserManager/Models/DnnModel/Users.cs similarity index 51% rename from Models/DnnModel/Users.cs rename to Modules/UserManager/Models/DnnModel/Users.cs index 9a47bf5..663233d 100644 --- a/Models/DnnModel/Users.cs +++ b/Modules/UserManager/Models/DnnModel/Users.cs @@ -1,4 +1,23 @@ -using System; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; @@ -22,6 +41,7 @@ public Users() public bool UpdatePassword { get; set; } public string LastIpaddress { get; set; } public bool IsDeleted { get; set; } + public bool Approved { get; set; } public int? CreatedByUserId { get; set; } public DateTime? CreatedOnDate { get; set; } public int? LastModifiedByUserId { get; set; } diff --git a/Modules/UserManager/Models/Settings.cs b/Modules/UserManager/Models/Settings.cs new file mode 100644 index 0000000..b9ace98 --- /dev/null +++ b/Modules/UserManager/Models/Settings.cs @@ -0,0 +1,32 @@ +/* +Copyright Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Upendo.Modules.UserManager.Models +{ + public class Settings + { + public bool Setting1 { get; set; } + public DateTime Setting2 { get; set; } + } +} \ No newline at end of file diff --git a/Module.build b/Modules/UserManager/Module.build similarity index 98% rename from Module.build rename to Modules/UserManager/Module.build index 6d5efc8..bd281c5 100644 --- a/Module.build +++ b/Modules/UserManager/Module.build @@ -1,7 +1,7 @@ Upendo.Modules.UserManager - UserManager + Upendo.UserManager Upendo.UserManager zip $(MSBuildProjectDirectory)\..\..\Build diff --git a/Module.css b/Modules/UserManager/Module.css similarity index 98% rename from Module.css rename to Modules/UserManager/Module.css index 023b764..1aa6bc7 100644 --- a/Module.css +++ b/Modules/UserManager/Module.css @@ -68,7 +68,6 @@ .buttomForm button { border: none; - color: white; padding: 12px 30px; text-align: center; text-decoration: none; @@ -82,7 +81,6 @@ .cancel-buttom { border: none; - color: white; background-color: grey; padding: 12px 30px; text-align: center; @@ -107,7 +105,7 @@ } .buttomForm #cancelEdit { - background-color: grey; + } .checkbox { diff --git a/NuGet.config b/Modules/UserManager/NuGet.config similarity index 100% rename from NuGet.config rename to Modules/UserManager/NuGet.config diff --git a/Properties/AssemblyInfo.cs b/Modules/UserManager/Properties/AssemblyInfo.cs similarity index 76% rename from Properties/AssemblyInfo.cs rename to Modules/UserManager/Properties/AssemblyInfo.cs index 9caa6a2..fa5c157 100644 --- a/Properties/AssemblyInfo.cs +++ b/Modules/UserManager/Properties/AssemblyInfo.cs @@ -5,12 +5,12 @@ // General Information about an assembly is controlled through the following // set of attributes. Change these attribute values to modify the information // associated with an assembly. -[assembly: AssemblyTitle("UserManager Modules Extension for DNN")] -[assembly: AssemblyDescription("Managed Users")] +[assembly: AssemblyTitle("Upendo DNN User Manager Module for DNN")] +[assembly: AssemblyDescription("Upendo DNN User Manager Extension for DNN")] [assembly: AssemblyConfiguration("")] -[assembly: AssemblyCompany("Upendo")] +[assembly: AssemblyCompany("Upendo Ventures, LLC")] [assembly: AssemblyProduct("UserManager Modules Extension for DNN")] -[assembly: AssemblyCopyright("Copyright 2023 Upendo")] +[assembly: AssemblyCopyright("Copyright (C) Upendo Ventures, LLC")] [assembly: AssemblyTrademark("")] [assembly: AssemblyCulture("")] @@ -20,7 +20,7 @@ [assembly: ComVisible(false)] // The following GUID is for the ID of the typelib if this project is exposed to COM -[assembly: Guid("F1C44008-72AC-40AE-AC92-2A3648C0BB14")] +[assembly: Guid("8DB6F62D-9211-4721-820A-6F39CE44E058")] // Version information for an assembly consists of the following four values: // diff --git a/Upendo.Modules.UserManager.csproj b/Modules/UserManager/Upendo.Modules.UserManager.csproj similarity index 64% rename from Upendo.Modules.UserManager.csproj rename to Modules/UserManager/Upendo.Modules.UserManager.csproj index 4cbc933..c25deaa 100644 --- a/Upendo.Modules.UserManager.csproj +++ b/Modules/UserManager/Upendo.Modules.UserManager.csproj @@ -7,7 +7,7 @@ 2.0 - {F1C44008-72AC-40AE-AC92-2A3648C0BB14} + {8DB6F62D-9211-4721-820A-6F39CE44E058} {349c5851-65df-11da-9384-00065b846f21};{fae04ec0-301f-11d3-bf4b-00c04f79efbc} Library Properties @@ -46,16 +46,13 @@ - - - - - - - - - 6.4.4 - + + + + + + + @@ -64,9 +61,6 @@ - - ..\..\..\..\Users\ntsprintdev005\.nuget\packages\dotnetnuke.core\9.3.2\lib\net45\DotNetNuke.dll - False $(HccReferencePath)\Hotcakes.Commerce.dll @@ -99,7 +93,6 @@ - @@ -108,20 +101,20 @@ - + - - + - - + + Designer + @@ -132,85 +125,61 @@ - - - - - - - - - - - - - - - - - - + Designer Designer - + Designer - - - - - + + + + + + + + + Designer - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + - 10.0 - $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) + 14.0 + + $(MSBuildExtensionsPath32)\Microsoft\VisualStudio\v$(VisualStudioVersion) - + diff --git a/Upendo.Modules.UserManager.sln b/Modules/UserManager/Upendo.Modules.UserManager.sln similarity index 68% rename from Upendo.Modules.UserManager.sln rename to Modules/UserManager/Upendo.Modules.UserManager.sln index 5aa61ae..a5f15ca 100644 --- a/Upendo.Modules.UserManager.sln +++ b/Modules/UserManager/Upendo.Modules.UserManager.sln @@ -3,7 +3,7 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio 15 VisualStudioVersion = 15.0.28307.329 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Upendo.Modules.UserManager", "Upendo.Modules.UserManager.csproj", "{F1C44008-72AC-40AE-AC92-2A3648C0BB14}" +Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Upendo.Modules.UserManager", "Upendo.Modules.UserManager.csproj", "{8DB6F62D-9211-4721-820A-6F39CE44E058}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution @@ -11,10 +11,10 @@ Global Release|Any CPU = Release|Any CPU EndGlobalSection GlobalSection(ProjectConfigurationPlatforms) = postSolution - {F1C44008-72AC-40AE-AC92-2A3648C0BB14}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {F1C44008-72AC-40AE-AC92-2A3648C0BB14}.Debug|Any CPU.Build.0 = Debug|Any CPU - {F1C44008-72AC-40AE-AC92-2A3648C0BB14}.Release|Any CPU.ActiveCfg = Release|Any CPU - {F1C44008-72AC-40AE-AC92-2A3648C0BB14}.Release|Any CPU.Build.0 = Release|Any CPU + {8DB6F62D-9211-4721-820A-6F39CE44E058}.Debug|Any CPU.ActiveCfg = Debug|Any CPU + {8DB6F62D-9211-4721-820A-6F39CE44E058}.Debug|Any CPU.Build.0 = Debug|Any CPU + {8DB6F62D-9211-4721-820A-6F39CE44E058}.Release|Any CPU.ActiveCfg = Release|Any CPU + {8DB6F62D-9211-4721-820A-6F39CE44E058}.Release|Any CPU.Build.0 = Release|Any CPU EndGlobalSection GlobalSection(SolutionProperties) = preSolution HideSolutionNode = FALSE diff --git a/UserManager.dnn b/Modules/UserManager/Upendo.UserManager.dnn similarity index 67% rename from UserManager.dnn rename to Modules/UserManager/Upendo.UserManager.dnn index 0f6a966..8d003ce 100644 --- a/UserManager.dnn +++ b/Modules/UserManager/Upendo.UserManager.dnn @@ -2,49 +2,34 @@ - UserManager Module + Upendo DNN User Manager - Managed Users

]]> + The Upendo DNN User Manager empowers authorized end-users in your DNN website to be able to manage user accounts and their assigned security roles.

]]>
DesktopModules/MVC/Upendo.Modules.UserManager/Images/logo.png - Upendo - Upendo - https://upendoventures.com/]]> - support@upendoventures.com]]> + Will Strohl + Upendo Ventures, LLC + https://upendoventures.com/What/CMS/DNN]]> + solutuions@upendoventures.com]]> true - 09.03.02 + 09.09.00 - - - DesktopModules\MVC\Upendo.Modules.UserManager - - - - - UserManager Module + Upendo DNN User Manager Upendo.Modules.UserManager Upendo.Modules.UserManager.Components.UserManagerController, Upendo.Modules.UserManager - UserManager Module + Upendo DNN User Manager 0 @@ -68,16 +53,6 @@ 0 True - - Settings - Upendo.Modules.UserManager.Controllers/Settings/Settings.mvc - False - UserManager Settings - Edit - - - 0 - diff --git a/UserManager_Symbols.dnn b/Modules/UserManager/Upendo.UserManager_Symbols.dnn similarity index 69% rename from UserManager_Symbols.dnn rename to Modules/UserManager/Upendo.UserManager_Symbols.dnn index 7f70358..355145e 100644 --- a/UserManager_Symbols.dnn +++ b/Modules/UserManager/Upendo.UserManager_Symbols.dnn @@ -2,13 +2,13 @@ - UserManager Module Symbols - + Upendo DNN User Manager Symbols + - Upendo - Upendo - https://upendoventures.com/ - support@upendoventures.com + Will Strohl + Upendo Ventures, LLC + https://upendoventures.com/What/CMS/DNN + solutions@upendoventures.com diff --git a/Modules/UserManager/Utility/Functions.cs b/Modules/UserManager/Utility/Functions.cs new file mode 100644 index 0000000..45e8264 --- /dev/null +++ b/Modules/UserManager/Utility/Functions.cs @@ -0,0 +1,155 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System.Collections.Generic; +using System.Linq; +using Upendo.Modules.UserManager.Models.DnnModel; +using DotNetNuke.Entities.Users; +using Upendo.Modules.UserManager.ViewModels; +using System; +using System.Web; +using DotNetNuke.Security.Permissions; + +namespace Upendo.Modules.UserManager.Utility +{ + public class Functions + { + public static Users MakeUser(UserInfo u) + { + var user = new Users() + { + UserId = u.UserID, + FirstName = u.FirstName, + LastName = u.LastName, + Username = u.Username, + DisplayName = u.DisplayName, + Email = u.Email, + IsSuperUser = u.IsSuperUser, + IsDeleted = u.IsDeleted, + Approved = u.Membership.Approved, + }; + return user; + } + public static Users MakeUserFromViewModel(UserViewModel u) + { + var user = new Users() + { + UserId = u.UserId, + FirstName = u.FirstName, + LastName = u.LastName, + Username = u.Username, + DisplayName = u.DisplayName, + Email = u.Email, + IsSuperUser = u.IsSuperUser, + IsDeleted = u.IsDeleted, + }; + return user; + } + public static DataTableResponse ListOfUsers(object[] getUsers, Pagination pagination) + { + var users = new List(); + foreach (UserInfo u in getUsers) + { + users.Add(MakeUser(u)); + } + users = users.OrderBy(x => x.UserId).ToList(); + if (pagination.Filter == "Authorized") + { + users = users.Where(u => u.Approved).ToList(); + } + var usersTotal = users.Count(); + double pagesTotal = usersTotal / pagination.Take; + if (!string.IsNullOrEmpty(pagination.Search) && pagination.Search != " ") + { + string searchTerm = pagination.Search.Trim().ToLower(); + users = users + .Where(e => + (e.FirstName?.ToLower()?.Contains(searchTerm) ?? false) || + (e.DisplayName?.ToLower()?.Contains(searchTerm) ?? false) || + (e.Email?.ToLower()?.Contains(searchTerm) ?? false) || + (e.Username?.ToLower()?.Contains(searchTerm) ?? false) + ) + .ToList(); + if (users.Count < 10) + { + pagination.PageIndex = 0; + } + } + users = users.Skip(pagination.PageIndex).Take((int)pagination.Take).ToList(); + pagesTotal = Math.Ceiling(Math.Max(pagesTotal, 2)) == 0 ? 1 : Math.Ceiling(Math.Max(pagesTotal, 2)); + if (!string.IsNullOrEmpty(pagination.OrderBy)) + { + switch (pagination.OrderBy) + { + case "Username": + users = pagination.Order == "desc" ? users.OrderByDescending(x => x.Username).ToList() : users.OrderBy(x => x.Username).ToList(); + break; + case "DisplayName": + users = pagination.Order == "desc" ? users.OrderByDescending(x => x.DisplayName).ToList() : users.OrderBy(x => x.DisplayName).ToList(); + break; + case "Email": + users = pagination.Order == "desc" ? users.OrderByDescending(x => x.Email).ToList() : users.OrderBy(x => x.Email).ToList(); + break; + } + } + return new DataTableResponse() { Take = pagination.Take, PageIndex = pagination.PageIndex, PagesTotal = pagesTotal, RecordsTotal = usersTotal, Search = pagination.Search, OrderBy = pagination.OrderBy, Order = pagination.Order, Data = users }; + } + public static DataTableResponse ListOfRoles(List roles, int rolesTotal, double take, int pageIndex, int goToPageValue, string search, string orderBy, string order) + { + if (!string.IsNullOrEmpty(search) && search != " ") + { + roles = roles.Where(e => string.Concat(e.RoleName.ToLower()).Contains(search.Trim().ToLower())).ToList(); + rolesTotal = roles.Count(); + pageIndex = 0; + } + roles = roles.Skip(pageIndex).Take((int)take).ToList(); + double total = rolesTotal / take; + var pagesTotal = Math.Ceiling(total); + if (!string.IsNullOrEmpty(orderBy)) + { + switch (orderBy) + { + case "RoleName": + roles = order == "desc" ? roles.OrderByDescending(x => x.RoleName).ToList() : roles.OrderBy(x => x.RoleName).ToList(); + break; + } + } + return new DataTableResponse() { Take = take, PageIndex = pageIndex, PagesTotal = pagesTotal, RecordsTotal = rolesTotal, GoToPage = goToPageValue, Search = search, OrderBy = orderBy, Order = order, Data = roles }; + } + public static string DNNCookie() + { + HttpRequest currentRequest = HttpContext.Current.Request; + string aspxAnonymousCookie = currentRequest.Cookies[".ASPXANONYMOUS"]?.Value; + string dnnIsMobileCookie = currentRequest.Cookies["dnn_IsMobile"]?.Value; + string languageCookie = currentRequest.Cookies["language"]?.Value; + string requestVerificationTokenCookie = currentRequest.Cookies["__RequestVerificationToken"]?.Value; + string authenticationCookie = currentRequest.Cookies["authentication"]?.Value; + string dotNetNukeCookie = currentRequest.Cookies[".DOTNETNUKE"]?.Value; + var result = $".ASPXANONYMOUS={aspxAnonymousCookie}; dnn_IsMobile={dnnIsMobileCookie}; language={languageCookie}; __RequestVerificationToken={requestVerificationTokenCookie}; authentication={authenticationCookie}; .DOTNETNUKE={dotNetNukeCookie}"; + return result; + } + public static bool HasPermission(DotNetNuke.UI.Modules.ModuleInstanceContext ModuleContext) + { + int moduleId = ModuleContext.ModuleId; + int tabId = ModuleContext.TabId; + ModulePermissionCollection permissions = ModulePermissionController.GetModulePermissions(moduleId, tabId); + return ModulePermissionController.HasModulePermission(permissions, "EDIT"); + } + } +} \ No newline at end of file diff --git a/Utility/RolesRepository.cs b/Modules/UserManager/Utility/RolesRepository.cs similarity index 62% rename from Utility/RolesRepository.cs rename to Modules/UserManager/Utility/RolesRepository.cs index 5cf1c02..21b9620 100644 --- a/Utility/RolesRepository.cs +++ b/Modules/UserManager/Utility/RolesRepository.cs @@ -1,8 +1,28 @@ -using System.Collections.Generic; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System.Collections.Generic; using System.Linq; using Upendo.Modules.UserManager.Models.DnnModel; using Upendo.Modules.UserManager.ViewModels; using DotNetNuke.Security.Roles; +using DotNetNuke.Services.Localization; namespace Upendo.Modules.UserManager.Utility { @@ -64,13 +84,13 @@ public static RolesViewModel GetRole(int portalId, int id) } public static List GetRoleGroups(int portalId) { - var roleGroups= RoleController.GetRoleGroups(portalId).ToArray(); + var roleGroups = RoleController.GetRoleGroups(portalId).ToArray(); var groups = new List(); foreach (RoleGroupInfo item in roleGroups) { var rolGroup = new RoleGroups() { - RoleGroupId=item.RoleGroupID, + RoleGroupId = item.RoleGroupID, RoleGroupName = item.RoleGroupName, }; groups.Add(rolGroup); @@ -82,11 +102,12 @@ public static void CreateRol(RolesViewModel rol) var rolInfo = new RoleInfo() { RoleID = rol.RoleId, - RoleName= rol.RoleName, + RoleName = rol.RoleName, AutoAssignment = rol.AutoAssignment, - IsPublic= rol.IsPublic, + IsPublic = rol.IsPublic, Description = rol.Description, - RoleGroupID= rol.RoleGroupID, + RoleGroupID = rol.RoleGroupID, + Status = rol.Status, }; RoleController.Instance.AddRole(rolInfo); } @@ -100,15 +121,27 @@ public static void EditRol(RolesViewModel rol) AutoAssignment = rol.AutoAssignment, IsPublic = rol.IsPublic, Description = rol.Description, - RoleGroupID= rol.RoleGroupID, + RoleGroupID = rol.RoleGroupID, + Status = rol.Status, }; RoleController.Instance.UpdateRole(rolInfo); } - public static void DeleteRol(int itemId,int portalId) + public static void DeleteRol(int itemId, int portalId) { var u = RoleController.Instance.GetRoleById(portalId, itemId); RoleController.Instance.DeleteRole(u); } + public static List StatusList() + { + string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/RolesManageController.resx"; + var statusList= new List + { + new { Status = -1, Name = Localization.GetString("Pending.Text", ResourceFile) }, + new { Status = 0, Name = Localization.GetString("Disabled.Text", ResourceFile) }, + new { Status = 1, Name = Localization.GetString("Approved.Text", ResourceFile) }, + }; + return statusList; + } } } diff --git a/Utility/UserRepository.cs b/Modules/UserManager/Utility/UserRepository.cs similarity index 70% rename from Utility/UserRepository.cs rename to Modules/UserManager/Utility/UserRepository.cs index 8f0897f..a03d99d 100644 --- a/Utility/UserRepository.cs +++ b/Modules/UserManager/Utility/UserRepository.cs @@ -1,6 +1,24 @@ -using System; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; using System.Collections.Generic; -using System.Data.Entity; using System.IO; using System.Linq; using System.Net; @@ -21,7 +39,7 @@ public class UserRepository /// /// /// - public static DataTableResponse GetUsers(Pagination pagination) + public static DataTableResponse GetUsers(Pagination pagination, int portalId) { pagination.Take = pagination.Take == 0 ? 10 : pagination.Take; int goToPage = pagination.GoToPage ?? default; @@ -33,27 +51,37 @@ public static DataTableResponse GetUsers(Pagination pagination) { pagination.PageIndex = 0; } - var result = new List(); - var users = new List(); - var usersTotal = 0.0; - var url = $"/API/PersonaBar/Users/GetUsers?searchText={pagination.Search}&filter={pagination.Filter}&pageIndex={pagination.PageIndex}&pageSize={pagination.Take}&sortColumn={pagination.OrderBy}&sortAscending={ (pagination.Order != "desc") }&resetIndex=true"; - string apiUrl = pagination.ServerUrl + url; - ServicePointManager.ServerCertificateValidationCallback = delegate { return true; }; - WebRequest request = WebRequest.Create(apiUrl); - request.Method = "GET"; - request.Headers.Add(HttpRequestHeader.Cookie, Functions.DNNCookie()); - using (WebResponse response = request.GetResponse()) - using (Stream stream = response.GetResponseStream()) - using (StreamReader reader = new StreamReader(stream)) + var currentUser = UserController.Instance.GetCurrentUserInfo(); + var totalRecords = 0; + + switch (pagination.Filter) { - string jsonResponse = reader.ReadToEnd(); - var deserializeObject = Newtonsoft.Json.JsonConvert.DeserializeObject(jsonResponse); - result = deserializeObject.Results; - users = (from UserViewModel u in result select Functions.MakeUserFromViewModel(u)).ToList(); - usersTotal = deserializeObject.TotalResults; + case "Unauthorized": + var getUsers = UserController.GetUnAuthorizedUsers(portalId).ToArray(); + return Functions.ListOfUsers(getUsers, pagination); + + case "Deleted": + getUsers = UserController.GetDeletedUsers(portalId).ToArray(); + return Functions.ListOfUsers(getUsers, pagination); + + case "SuperUsers": + var superUsers = currentUser.IsSuperUser ? UserController.GetUsers(-1, 1, int.MaxValue, ref totalRecords, false, true).ToArray() + : new Users[0]; + getUsers = superUsers; + return Functions.ListOfUsers(getUsers, pagination); + + case "All": + getUsers = UserController.GetUsers(portalId).ToArray(); + var deletedUsers = UserController.GetDeletedUsers(portalId).ToArray(); + var super_Users = currentUser.IsSuperUser ? UserController.GetUsers(-1, 1, int.MaxValue, ref totalRecords, false, true).ToArray() + : new Users[0]; + getUsers = getUsers.Concat(deletedUsers).Concat(super_Users).ToArray(); + return Functions.ListOfUsers(getUsers, pagination); + + default: + getUsers = UserController.GetUsers(portalId).ToArray(); + return Functions.ListOfUsers(getUsers, pagination); } - var pagesTotal = Math.Ceiling(usersTotal / pagination.Take); - return new DataTableResponse() { Take = pagination.Take, PageIndex = pagination.PageIndex, PagesTotal = pagesTotal, RecordsTotal = usersTotal, GoToPage = goToPage, Search = pagination.Search, OrderBy = pagination.OrderBy, Order = pagination.Order, Data = users }; } /// @@ -66,16 +94,18 @@ public static DataTableResponse GetUsers(Pagination pagination) /// /// /// - public static DataTableResponse GetRolesByUser(double take, int pageIndex, int? goToPage, int - portalId, string search, int itemId) + public static DataTableResponse GetRolesByUser(double take, int pageIndex, int? goToPage, int portalId, string search, int itemId) { var roles = RoleController.Instance.GetRoles(portalId); var rolesViewModel = new List(); var userInfo = UserController.GetUserById(portalId, itemId); + UserInfo currentUser = UserController.Instance.GetCurrentUserInfo(); + bool isAdminOrSuperUser = currentUser.IsSuperUser || currentUser.IsInRole("Administrators"); foreach (var item in roles) { if (item.Status != RoleStatus.Approved) continue; + if (item.RoleName == "Administrators" && !isAdminOrSuperUser) continue; var rolViewModel = new RolesViewModel() { RoleId = item.RoleID, @@ -192,6 +222,7 @@ public static void CreateUser(UserViewModel user, int portalId) /// public static void EditUser(int portalId, UserViewModel user) { + var currentUser = UserController.Instance.GetCurrentUserInfo(); var userInfo = UserController.GetUserById(portalId, user.UserId); if (userInfo == null) return; userInfo.FirstName = user.FirstName; @@ -199,8 +230,8 @@ public static void EditUser(int portalId, UserViewModel user) userInfo.Email = user.Email; userInfo.Username = user.Username; userInfo.PortalID = portalId; - userInfo.IsSuperUser = user.IsSuperUser; - userInfo.IsDeleted = user.IsDeleted; + userInfo.IsSuperUser = currentUser.IsSuperUser ? user.IsSuperUser : false; + userInfo.IsDeleted = currentUser.IsSuperUser ? user.IsDeleted : false; userInfo.Membership.Approved = user.Approved; userInfo.Membership.LockedOut = user.LockedOut; if (!string.IsNullOrEmpty(user.Password) && user.Password != " ") diff --git a/Modules/UserManager/ViewModels/Pagination.cs b/Modules/UserManager/ViewModels/Pagination.cs new file mode 100644 index 0000000..ac6f893 --- /dev/null +++ b/Modules/UserManager/ViewModels/Pagination.cs @@ -0,0 +1,51 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System.Collections.Generic; + +namespace Upendo.Modules.UserManager.ViewModels +{ + public struct Pagination + { + public double Take { get; set; } + public int PageIndex { get; set; } + public string Filter { get; set; } + public int? GoToPage { get; set; } + public int PortalId { get; set; } + public string Search { get; set; } + public string OrderBy; + public string Order; + public string ServerUrl; + } + public struct DataTableResponse + { + public double Take { get; set; } + public int PageIndex { get; set; } + public int Page { get; set; } + public int GoToPage { get; set; } + public double PagesTotal { get; set; } + public double RecordsTotal { get; set; } + public int RecordsFiltered { get; set; } + public string Search; + public string OrderBy; + public string Order; + public List Data; + } + +} \ No newline at end of file diff --git a/Modules/UserManager/ViewModels/ResultJsonViewModel.cs b/Modules/UserManager/ViewModels/ResultJsonViewModel.cs new file mode 100644 index 0000000..3a92bfe --- /dev/null +++ b/Modules/UserManager/ViewModels/ResultJsonViewModel.cs @@ -0,0 +1,33 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using DotNetNuke.Entities.Users; +using System; +using System.Collections.Generic; +using System.ComponentModel.DataAnnotations; +using Upendo.Modules.UserManager.Models.DnnModel; + +namespace Upendo.Modules.UserManager.ViewModels +{ + public class ResultJsonViewModel + { + public List Results { get; set; } + public int TotalResults { get; set; } + } +} \ No newline at end of file diff --git a/Modules/UserManager/ViewModels/RolesViewModel.cs b/Modules/UserManager/ViewModels/RolesViewModel.cs new file mode 100644 index 0000000..b3a1c3b --- /dev/null +++ b/Modules/UserManager/ViewModels/RolesViewModel.cs @@ -0,0 +1,44 @@ +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using DotNetNuke.Security.Roles; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Web; + +namespace Upendo.Modules.UserManager.ViewModels +{ + public class RolesViewModel + { + public int RoleId { get; set; } + public int? PortalId { get; set; } + public int RoleGroupID { get; set; } + public string RoleName { get; set; } + public string Description { get; set; } + public bool AutoAssignment { get; set; } + public bool IsPublic { get; set; } + public bool IsSystemRole { get; set; } + public int? UserCount { get; set; } + public RoleStatus Status { get; set; } + public RoleType RoleType { get; set; } + public bool HasRole { get; set; } + public int? Index { get; set; } + } +} \ No newline at end of file diff --git a/ViewModels/UserViewModel.cs b/Modules/UserManager/ViewModels/UserViewModel.cs similarity index 61% rename from ViewModels/UserViewModel.cs rename to Modules/UserManager/ViewModels/UserViewModel.cs index 9fc281b..bdb1f73 100644 --- a/ViewModels/UserViewModel.cs +++ b/Modules/UserManager/ViewModels/UserViewModel.cs @@ -1,4 +1,23 @@ -using System; +/* +Copyright © Upendo Ventures, LLC + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and +associated documentation files (the "Software"), to deal in the Software without restriction, +including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, +and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial +portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT +NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND +NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES +OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. + */ + +using System; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; using Upendo.Modules.UserManager.Models.DnnModel; @@ -7,12 +26,14 @@ namespace Upendo.Modules.UserManager.ViewModels { public class UserViewModel { - [Key] public int UserId { get; set; } + [Required] public string Username { get; set; } + [Required] public string FirstName { get; set; } + [Required] public string LastName { get; set; } public bool IsSuperUser { get; set; } diff --git a/Views/RolesManage/Create.cshtml b/Modules/UserManager/Views/RolesManage/Create.cshtml similarity index 58% rename from Views/RolesManage/Create.cshtml rename to Modules/UserManager/Views/RolesManage/Create.cshtml index f9952ea..408cd92 100644 --- a/Views/RolesManage/Create.cshtml +++ b/Modules/UserManager/Views/RolesManage/Create.cshtml @@ -1,35 +1,45 @@ @inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage @using System.Collections.Generic @using DotNetNuke.Web.Mvc.Helpers +@using DotNetNuke.Services.Localization; + +@{ + string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/AddEditRoles.resx"; +}
-
+
@Html.TextBoxFor(m => m.RoleName)
-
+
@Html.TextBoxFor(m => m.Description)
-
+
@Html.DropDownListFor(m => m.RoleGroupID, new SelectList(ViewBag.RoleGroups, "RoleGroupId", "RoleGroupName"))
+
+
+ @Html.DropDownListFor(m => m.Status, new SelectList(ViewBag.StatusList, "Status", + "Name")) +
- @Html.CheckBoxFor(m => m.AutoAssignment, new { @id = "checkbox" }) - + @Html.CheckBoxFor(m => m.AutoAssignment, new { @id = "chkAutoAssign" }) +
- @Html.CheckBoxFor(m => m.IsPublic, new { @id = "checkbox" }) - + @Html.CheckBoxFor(m => m.IsPublic, new { @id = "chkIsPublic" }) +
@Html.HiddenFor(m => m.RoleId)
- - + +
\ No newline at end of file diff --git a/Modules/UserManager/Views/Shared/Error.cshtml b/Modules/UserManager/Views/Shared/Error.cshtml new file mode 100644 index 0000000..7ed46ef --- /dev/null +++ b/Modules/UserManager/Views/Shared/Error.cshtml @@ -0,0 +1,8 @@ + +@{ + ViewBag.Title = "Error"; +} + +
+

@ViewBag.ErrorMessage

+
\ No newline at end of file diff --git a/Views/Shared/_Layout.cshtml b/Modules/UserManager/Views/Shared/_Layout.cshtml similarity index 100% rename from Views/Shared/_Layout.cshtml rename to Modules/UserManager/Views/Shared/_Layout.cshtml diff --git a/Views/UserManage/ChangePassword.cshtml b/Modules/UserManager/Views/UserManage/ChangePassword.cshtml similarity index 52% rename from Views/UserManage/ChangePassword.cshtml rename to Modules/UserManager/Views/UserManage/ChangePassword.cshtml index ecd2a88..6692e45 100644 --- a/Views/UserManage/ChangePassword.cshtml +++ b/Modules/UserManager/Views/UserManage/ChangePassword.cshtml @@ -2,6 +2,10 @@ @using System.Collections.Generic @using DotNetNuke.Web.Mvc.Helpers +@using DotNetNuke.Services.Localization; +@{ + string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/AddEdit.resx"; +}
@@ -11,16 +15,23 @@
-
- @Html.TextBoxFor(m => m.Password, new { @id = "password", @type = "password" }) +
+ @Html.TextBoxFor(m => m.Password, new + { + @class = "form-control", + @id = "password", + @type = "password", + onkeyup = "handlePasswordValidation();" + }) +
-
+
@Html.TextBoxFor(m => m.ConfirmPassword, new { - @id = "confirm_password", - @type = "password", - onkeyup = "validatePassword();" + @id = "confirm_password", + @type = "password", + onkeyup = "validatePassword();" })
@@ -36,19 +47,48 @@
\ No newline at end of file diff --git a/Modules/UserManager/Views/UserManage/Edit.cshtml b/Modules/UserManager/Views/UserManage/Edit.cshtml new file mode 100644 index 0000000..a41d9ae --- /dev/null +++ b/Modules/UserManager/Views/UserManage/Edit.cshtml @@ -0,0 +1,227 @@ +@inherits DotNetNuke.Web.Mvc.Framework.DnnWebViewPage + +@using System.Collections.Generic +@using DotNetNuke.Web.Mvc.Helpers +@using DotNetNuke.Services.Localization; + +@{ + string defaultUserPicture = "/DesktopModules/MVC/Upendo.Modules.UserManager/Images/defaultUserPicture.jpg"; + string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/AddEdit.resx"; +} +
+
+

@Localization.GetString("AccountSettings", @ResourceFile)

+ @if (!ViewData.ModelState.IsValid) + { +
+ @Html.ValidationSummary(false, "", new { @class = "" }) +
+ } +
+
+
+ @Html.TextBoxFor(m => m.FirstName) + @Html.ValidationMessageFor(m => m.FirstName) +
+
+
+ @Html.TextBoxFor(m => m.LastName) + @Html.ValidationMessageFor(m => m.LastName) +
+
+
+ @Html.TextBoxFor(m => m.Username) + @Html.ValidationMessageFor(m => m.Username) +
+
+
+ @Html.TextBoxFor(m => m.Email, new { @class = "form-control", @type = "email" }) + @Html.ValidationMessageFor(m => m.Email) +
+
+
+ @Html.TextBoxFor(m => m.Password, new + { + @class = "form-control", + @id = "password", + @type = "password", + onkeyup = "handlePasswordValidation();" + }) + +
+
+
+ @Html.TextBoxFor(m => m.ConfirmPassword, new + { + @id = "confirm_password", + @type = "password", + onkeyup = "validatePassword();" + }) + +
+
+
+ @Html.CheckBoxFor(m => m.IsSuperUser, new { @id = "chkIsSuperuser", @class = "superuser-checkbox" }) + +
+
+ @Html.CheckBoxFor(m => m.Approved, new { @id = "chkApproved" }) + +
+
+ @Html.CheckBoxFor(m => m.IsDeleted, new { @id = "chkIsDeleted" }) + +
+
+ @Html.CheckBoxFor(m => m.SendEmail, new { @id = "chkSendEmail" }) + +
+ @Html.HiddenFor(m => m.UserId) +
+
+ +
+
+
+

@Localization.GetString("AccountData", @ResourceFile)

+
+
+ User +
+

@Localization.GetString("UserId", @ResourceFile) @Model.UserId

+

@Localization.GetString("DisplayName", @ResourceFile) @Model.DisplayName

+

@Localization.GetString("CreatedOnDate", @ResourceFile) @Model.CreatedOnDate

+

@Localization.GetString("LastModifiedOnDate", @ResourceFile) @Model.LastModifiedOnDate

+

@Localization.GetString("UpdatePassword", @ResourceFile) @Model.UpdatePassword

+

@Localization.GetString("UserRoles", @ResourceFile)

+
    + @{ + foreach (var item in Model.UserRoles) + { +
  • @item
  • + } + } +
+
+
+
+
+
+ + +
+
+
+ + \ No newline at end of file diff --git a/Views/UserManage/Index.cshtml b/Modules/UserManager/Views/UserManage/Index.cshtml similarity index 61% rename from Views/UserManage/Index.cshtml rename to Modules/UserManager/Views/UserManage/Index.cshtml index b87f81b..0fbc470 100644 --- a/Views/UserManage/Index.cshtml +++ b/Modules/UserManager/Views/UserManage/Index.cshtml @@ -3,44 +3,42 @@ @using System.Text.RegularExpressions @using DotNetNuke.Web.Mvc.Helpers @using Upendo.Modules.UserManager.ViewModels; +@using DotNetNuke.Services.Localization; @{ string srcLogo = DotNetNuke.Entities.Tabs.TabController.CurrentPage.Title + "/DesktopModules/MVC/Upendo.Modules.UserManager/Images/Upendo-logo-trans.png"; - var pageIndexMinus = (@Model.PageIndex - 1) <= 0 ? 0 : (@Model.PageIndex - 1); - var pageIndexPlus = @Model.PageIndex + 1; - double pageIndexPaginate = (@Model.PageIndex * @Model.Take) + 1; + var pageIndexMinus = (@Model.PageIndex - @Model.Take) <= 0 ? 0 : (@Model.PageIndex - @Model.Take); + var pageIndexPlus = @Model.PageIndex + @Model.Take; + double pageIndexPaginate = @Model.PageIndex + 1; var pageIndexTo = (pageIndexPaginate + @Model.Take) - 1; - double pageView = Model.PageIndex + 1; + var skipTo = @Model.PageIndex + @Model.Take; + double pageView = (skipTo / @Model.Take) == 0 ? 1 : (skipTo / @Model.Take); + string ResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/Index.resx"; + string SharedResourceFile = "~/DesktopModules/MVC/Upendo.Modules.UserManager/App_LocalResources/Shared.resx"; + }
-
-
- logo -
-
-

Upendo User Manage

-

Module for user management in DNN

-
-
-
@@ -51,7 +49,7 @@