33 lines
1.1 KiB
C#
33 lines
1.1 KiB
C#
using Mini.Web.WebHelper.Models;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Mini.Web.WebHelper
|
|
{
|
|
public class ToolButtonView
|
|
{
|
|
public string[] ToolButtonRight(InnerRight right, string[] rights)
|
|
{
|
|
List<string> toolbuttons = new List<string>();
|
|
string[] rolesRights = rights.Where(p => p.Contains(right.RightId)).ToArray();
|
|
for (int i = 0; i < rolesRights.Length; i++)
|
|
{
|
|
if (rolesRights[i] != null && (rolesRights[i].Length > 4) && (string.Compare(rolesRights[i], 0, right.RightId, 0, 4, StringComparison.OrdinalIgnoreCase) == 0))
|
|
{
|
|
int toolbar = Convert.ToInt32(rolesRights[i].Substring(4));
|
|
foreach (var model in right.ToolBars)
|
|
{
|
|
if ((toolbar & model.ToolBarId) > 0)
|
|
{
|
|
toolbuttons.Add(model.ToolBarCode);
|
|
}
|
|
}
|
|
}
|
|
}
|
|
return toolbuttons.Distinct().ToArray();
|
|
}
|
|
}
|
|
}
|