Merge branch 'U4-8189' of https://github.com/danlister/Umbraco-CMS into danlister-U4-8189
Conflicts: src/Umbraco.Core/Constants-Applications.cs src/Umbraco.Web/Umbraco.Web.csproj
This commit is contained in:
@@ -114,6 +114,11 @@
|
||||
/// </summary>
|
||||
public const string UserTypes = "userTypes";
|
||||
|
||||
/// <summary>
|
||||
/// alias for the users tree.
|
||||
/// </summary>
|
||||
public const string Users = "users";
|
||||
|
||||
public const string Scripts = "scripts";
|
||||
|
||||
public const string PartialViews = "partialViews";
|
||||
|
||||
@@ -964,6 +964,7 @@
|
||||
<key alias="templates">Šablony</key>
|
||||
<key alias="xslt">XSLT soubory</key>
|
||||
<key alias="userTypes">Typy Uživatelů</key>
|
||||
<key alias="users">Uživatelé</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nová aktualizace je připrvena</key>
|
||||
|
||||
@@ -929,6 +929,7 @@ Vennlig hilsen Umbraco roboten
|
||||
<key alias="xslt">XSLT Filer</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">Brukertyper typer</key>
|
||||
<key alias="users">Brukere</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Ny oppdatering er klar</key>
|
||||
|
||||
@@ -23,7 +23,7 @@
|
||||
<add application="developer" alias="xslt" title="XSLT Files" type="Umbraco.Web.Trees.XsltTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="5" />
|
||||
<add application="developer" alias="partialViewMacros" type="Umbraco.Web.Trees.PartialViewMacrosTreeController, umbraco" silent="false" initialize="true" sortOrder="6" title="Partial View Macro Files" iconClosed="icon-folder" iconOpen="icon-folder" />
|
||||
<!--Users-->
|
||||
<add application="users" alias="users" title="Users" type="umbraco.loadUsers, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="0" />
|
||||
<add application="users" alias="users" title="Users" type="Umbraco.Web.Trees.UsersTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="0" />
|
||||
<add application="users" alias="userTypes" title="User Types" type="Umbraco.Web.Trees.UserTypesTreeController, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="1" />
|
||||
<add application="users" alias="userPermissions" title="User Permissions" type="umbraco.cms.presentation.Trees.UserPermissions, umbraco" iconClosed="icon-folder" iconOpen="icon-folder" sortOrder="2" />
|
||||
<!--Members-->
|
||||
|
||||
@@ -999,6 +999,7 @@ Mange hilsner fra Umbraco robotten
|
||||
<key alias="xslt">XSLT-filer</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">Bruger Typer</key>
|
||||
<key alias="users">Brugere</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Ny opdatering er klar</key>
|
||||
|
||||
@@ -947,6 +947,7 @@ Ihr freundlicher Umbraco-Robot
|
||||
<key alias="xslt">XSLT-Dateien</key>
|
||||
<key alias="analytics">Auswertungen</key>
|
||||
<key alias="userTypes">Benutzertypen</key>
|
||||
<key alias="users">Benutzer</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Neues Update verfügbar</key>
|
||||
|
||||
@@ -1189,6 +1189,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="xslt">XSLT Files</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">User Types</key>
|
||||
<key alias="users">Users</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">New update ready</key>
|
||||
|
||||
@@ -1193,6 +1193,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="xslt">XSLT Files</key>
|
||||
<key alias="analytics">Analytics</key>
|
||||
<key alias="userTypes">User Types</key>
|
||||
<key alias="users">Users</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">New update ready</key>
|
||||
|
||||
@@ -851,6 +851,7 @@
|
||||
<key alias="templates">Plantillas</key>
|
||||
<key alias="xslt">Archivos XSLT</key>
|
||||
<key alias="userTypes">Tipos de Usuarios</key>
|
||||
<key alias="users">Usuarios</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Existe una nueva actualización</key>
|
||||
|
||||
@@ -985,6 +985,7 @@ Pour gérer votre site, ouvrez simplement le backoffice Umbraco et commencez à
|
||||
<key alias="templates">Modèles</key>
|
||||
<key alias="xslt">Fichiers XSLT</key>
|
||||
<key alias="userTypes">Types d'utilisateurs</key>
|
||||
<key alias="users">Utilisateurs</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nouvelle mise à jour prête</key>
|
||||
|
||||
@@ -870,6 +870,7 @@ To manage your website, simply open the Umbraco back office and start adding con
|
||||
<key alias="templates">תבניות</key>
|
||||
<key alias="xslt">קבצי XSLT</key>
|
||||
<key alias="userTypes">משתמש מקליד</key>
|
||||
<key alias="users">משתמש</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">עידכון חדש זמין</key>
|
||||
|
||||
@@ -843,6 +843,7 @@ Per gestire il tuo sito web, è sufficiente aprire il back office di Umbraco e i
|
||||
<key alias="templates">Templates</key>
|
||||
<key alias="xslt">Files XSLT</key>
|
||||
<key alias="userTypes">Tipi di Utente</key>
|
||||
<key alias="users">Utenti</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable"><![CDATA[Nuovo aggiornamento pronto]]></key>
|
||||
|
||||
@@ -1159,7 +1159,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
|
||||
<key alias="memberRoles">役割</key>
|
||||
<key alias="memberTypes">メンバーの種類</key>
|
||||
<key alias="documentTypes">ドキュメントタイプ</key>
|
||||
<key alias="relationTypes">関連タイプ</key>
|
||||
<key alias="relationTypes">関連タイプ</key>
|
||||
<key alias="packager">パッケージ</key>
|
||||
<key alias="packages">パッケージ</key>
|
||||
<key alias="python">Python ファイル</key>
|
||||
@@ -1173,6 +1173,7 @@ Runwayをインストールして作られた新しいウェブサイトがど
|
||||
<key alias="xslt">XSLT ファイル</key>
|
||||
<key alias="analytics">アナリティクス</key>
|
||||
<key alias="userTypes">ユーザータイプ</key>
|
||||
<key alias="users">ユーザー</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">新しい更新があります</key>
|
||||
|
||||
@@ -847,6 +847,7 @@
|
||||
<key alias="templates">템플릿</key>
|
||||
<key alias="xslt">XSLT 파일</key>
|
||||
<key alias="userTypes">사용자 유형</key>
|
||||
<key alias="users">사용자</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">새 업데이트가 준비되었습니다.</key>
|
||||
|
||||
@@ -952,6 +952,7 @@ Om een vertalingstaak te sluiten, ga aub naar het detailoverzicht en klik op de
|
||||
<key alias="templates">Sjablonen</key>
|
||||
<key alias="xslt">XSLT Bestanden</key>
|
||||
<key alias="userTypes">Gebruiker Types</key>
|
||||
<key alias="users">Gebruikers</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nieuwe update beschikbaar</key>
|
||||
|
||||
@@ -743,6 +743,7 @@ Miłego dnia!]]></key>
|
||||
<key alias="templates">Szablony</key>
|
||||
<key alias="xslt">Pliki XSLT</key>
|
||||
<key alias="userTypes">Typy Użytkowników</key>
|
||||
<key alias="users">Użytkowników</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Aktualizacja jest gotowa</key>
|
||||
|
||||
@@ -831,6 +831,7 @@ Para fechar a tarefa de tradução vá até os detalhes e clique no botão "Fech
|
||||
<key alias="templates">Modelos</key>
|
||||
<key alias="xslt">Arquivos XSLT</key>
|
||||
<key alias="userTypes">Tipos de Usuários</key>
|
||||
<key alias="users">Usuários</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Nova atualização pronta</key>
|
||||
|
||||
@@ -1162,6 +1162,7 @@
|
||||
<key alias="templates">Шаблоны</key>
|
||||
<key alias="xslt">Файлы XSLT</key>
|
||||
<key alias="userTypes">Типы пользователей</key>
|
||||
<key alias="users">пользователи</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Доступны обновления</key>
|
||||
|
||||
@@ -852,6 +852,7 @@
|
||||
<key alias="templates">Sidmallar</key>
|
||||
<key alias="xslt">XSLT-filer</key>
|
||||
<key alias="userTypes">Användartyper</key>
|
||||
<key alias="users">Användare</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">Ny uppdatering tillgänglig</key>
|
||||
|
||||
@@ -921,6 +921,7 @@
|
||||
<key alias="templates">模板</key>
|
||||
<key alias="xslt">XSLT文件</key>
|
||||
<key alias="userTypes">用户类型</key>
|
||||
<key alias="users">Users</key>
|
||||
</area>
|
||||
<area alias="update">
|
||||
<key alias="updateAvailable">有可用更新</key>
|
||||
|
||||
@@ -0,0 +1,103 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Linq;
|
||||
using System.Net.Http.Formatting;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Configuration;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Web.WebApi.Filters;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
using Umbraco.Core.Services;
|
||||
using Umbraco.Web.Models.Trees;
|
||||
using Umbraco.Web.Mvc;
|
||||
using Constants = Umbraco.Core.Constants;
|
||||
|
||||
namespace Umbraco.Web.Trees
|
||||
{
|
||||
[UmbracoTreeAuthorize(Constants.Trees.Users)]
|
||||
[Tree(Constants.Applications.Users, Constants.Trees.Users, null)]
|
||||
[PluginController("UmbracoTrees")]
|
||||
[CoreTree]
|
||||
public class UsersTreeController : TreeController
|
||||
{
|
||||
protected override TreeNodeCollection GetTreeNodes(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var nodes = new TreeNodeCollection();
|
||||
|
||||
int totalusers;
|
||||
var users = new List<IUser>(Services.UserService.GetAll(0, int.MaxValue, out totalusers));
|
||||
|
||||
var currentUser = UmbracoContext.Current.Security.CurrentUser;
|
||||
var currentUserIsAdmin = currentUser.IsAdmin();
|
||||
|
||||
foreach (var user in users.OrderBy(x => x.IsApproved == false))
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice &&
|
||||
(UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice == false ||
|
||||
user.IsApproved == false))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
var node = CreateTreeNode(
|
||||
user.Id.ToString(CultureInfo.InvariantCulture),
|
||||
"-1",
|
||||
queryStrings,
|
||||
user.Name,
|
||||
"icon-user",
|
||||
false,
|
||||
"/" + queryStrings.GetValue<string>("application") + "/framed/"
|
||||
+ Uri.EscapeDataString("users/EditUser.aspx?id=" + user.Id));
|
||||
|
||||
if (user.Id == 0)
|
||||
{
|
||||
if (currentUser.Id != 0)
|
||||
continue;
|
||||
}
|
||||
else if (currentUserIsAdmin == false && user.IsAdmin())
|
||||
continue;
|
||||
|
||||
if (user.IsApproved == false)
|
||||
node.CssClasses.Add("not-published");
|
||||
|
||||
nodes.Add(node);
|
||||
}
|
||||
|
||||
return nodes;
|
||||
}
|
||||
|
||||
protected override MenuItemCollection GetMenuForNode(string id, FormDataCollection queryStrings)
|
||||
{
|
||||
var menu = new MenuItemCollection();
|
||||
|
||||
if (id == Constants.System.Root.ToInvariantString())
|
||||
{
|
||||
// Root actions
|
||||
menu.Items.Add<ActionNew>(Services.TextService.Localize("actions", ActionNew.Instance.Alias))
|
||||
.ConvertLegacyMenuItem(null, "users", queryStrings.GetValue<string>("application"));
|
||||
|
||||
menu.Items.Add<RefreshNode, ActionRefresh>(
|
||||
Services.TextService.Localize("actions", ActionRefresh.Instance.Alias), true);
|
||||
return menu;
|
||||
}
|
||||
|
||||
// If administator, don't create a menu
|
||||
if (id == "0")
|
||||
return menu;
|
||||
|
||||
// Disable user
|
||||
menu.Items.Add<ActionDisable>(
|
||||
Services.TextService.Localize("actions", ActionDisable.Instance.Alias),
|
||||
false,
|
||||
new Dictionary<string, object>
|
||||
{
|
||||
{MenuItem.JsActionKey, ActionDisable.Instance.JsFunctionName}
|
||||
}
|
||||
);
|
||||
|
||||
return menu;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,6 +332,7 @@
|
||||
<Compile Include="Trees\StylesheetsTreeController.cs" />
|
||||
<Compile Include="Trees\UserTypesTreeController.cs" />
|
||||
<Compile Include="Trees\XsltTreeController.cs" />
|
||||
<Compile Include="Trees\UsersTreeController.cs" />
|
||||
<Compile Include="_Legacy\Actions\Action.cs" />
|
||||
<Compile Include="_Legacy\Actions\ActionAssignDomain.cs" />
|
||||
<Compile Include="_Legacy\Actions\ActionAudit.cs" />
|
||||
@@ -1532,7 +1533,6 @@
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadMemberGroups.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadPackages.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadTranslationTasks.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\loadUsers.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\NullTree.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeDefinitionCollection.cs" />
|
||||
<Compile Include="umbraco.presentation\umbraco\Trees\TreeDefinition.cs" />
|
||||
|
||||
@@ -1,112 +0,0 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Text;
|
||||
using Umbraco.Core.Configuration;
|
||||
using umbraco.cms.presentation.Trees;
|
||||
using System.Linq;
|
||||
using Umbraco.Core;
|
||||
using Umbraco.Core.Models;
|
||||
using Umbraco.Core.Models.Membership;
|
||||
using Umbraco.Web;
|
||||
using Umbraco.Web.Trees;
|
||||
using Umbraco.Web._Legacy.Actions;
|
||||
|
||||
|
||||
namespace umbraco
|
||||
{
|
||||
/// <summary>
|
||||
/// Handles loading of all umbraco users into the users application tree
|
||||
/// </summary>
|
||||
[Tree(Constants.Applications.Users, "users", "Users")]
|
||||
public class loadUsers : BaseTree
|
||||
{
|
||||
public loadUsers(string application) : base(application) { }
|
||||
|
||||
protected override void CreateRootNode(ref XmlTreeNode rootNode)
|
||||
{
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Renders the Javascript.
|
||||
/// </summary>
|
||||
/// <param name="Javascript">The javascript.</param>
|
||||
public override void RenderJS(ref StringBuilder Javascript)
|
||||
{
|
||||
Javascript.Append(
|
||||
@"
|
||||
function openUser(id) {
|
||||
UmbClientMgr.contentFrame('users/editUser.aspx?id=' + id);
|
||||
}
|
||||
");
|
||||
}
|
||||
|
||||
protected override void CreateAllowedActions(ref List<IAction> actions)
|
||||
{
|
||||
actions.Clear();
|
||||
actions.Add(ActionDisable.Instance);
|
||||
}
|
||||
|
||||
public override void Render(ref XmlTree tree)
|
||||
{
|
||||
int totalusers;
|
||||
var users = new List<IUser>(Services.UserService.GetAll(0, int.MaxValue, out totalusers));
|
||||
|
||||
var currUser = UmbracoContext.Current.Security.CurrentUser;
|
||||
|
||||
bool currUserIsAdmin = currUser.IsAdmin();
|
||||
foreach (var u in users.OrderBy(x => x.IsApproved == false))
|
||||
{
|
||||
if (UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice == false
|
||||
|| (UmbracoConfig.For.UmbracoSettings().Security.HideDisabledUsersInBackoffice && u.IsApproved))
|
||||
{
|
||||
|
||||
XmlTreeNode xNode = XmlTreeNode.Create(this);
|
||||
|
||||
// special check for ROOT user
|
||||
if (u.Id == 0)
|
||||
{
|
||||
//if its the administrator, don't create a menu
|
||||
xNode.Menu = null;
|
||||
//if the current user is not the administrator, then don't add this node.
|
||||
if (currUser.Id != 0)
|
||||
continue;
|
||||
}
|
||||
// Special check for admins in general (only show admins to admins)
|
||||
else if (!currUserIsAdmin && u.IsAdmin())
|
||||
{
|
||||
continue;
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
//xNode.IconClass = "umbraco-tree-icon-grey";
|
||||
|
||||
xNode.NodeID = u.Id.ToString();
|
||||
xNode.Text = u.Name;
|
||||
xNode.Action = "javascript:openUser(" + u.Id + ");";
|
||||
xNode.Icon = "icon-user";
|
||||
xNode.OpenIcon = "icon-user";
|
||||
|
||||
if (u.IsApproved == false) {
|
||||
xNode.Style.DimNode();
|
||||
}
|
||||
|
||||
OnBeforeNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
if (xNode != null)
|
||||
{
|
||||
tree.Add(xNode);
|
||||
OnAfterNodeRender(ref tree, ref xNode, EventArgs.Empty);
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -214,8 +214,8 @@ namespace umbraco.cms.presentation.user
|
||||
SetupForm();
|
||||
|
||||
ClientTools
|
||||
.SetActiveTreeType(TreeDefinitionCollection.Instance.FindTree<loadUsers>().Tree.Alias)
|
||||
.SyncTree(UID.ToString(), IsPostBack);
|
||||
.SetActiveTreeType(Constants.Trees.Users)
|
||||
.SyncTree(UID.ToString(), false);
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user