60 lines
1.9 KiB
C#
60 lines
1.9 KiB
C#
using System;
|
|
using System.Web;
|
|
using WX.CRM.Common;
|
|
using WX.CRM.WebHelper.UtilityModel;
|
|
|
|
namespace WX.CRM.WebHelper
|
|
{
|
|
public class UserRightsHelper
|
|
{
|
|
|
|
public static string[] getUserRights()
|
|
{
|
|
UserRights userRights = new UserRights();
|
|
//LogHelper.Info(HttpContext.Current.Request.IsAuthenticated.ToString());
|
|
if (HttpContext.Current.Request.IsAuthenticated)
|
|
{
|
|
string userId = HttpContext.Current.User.Identity.Name;
|
|
string cacheKey = "Cache_UserInfo_" + userId;
|
|
if (CacheHelper.Exists(cacheKey))
|
|
{
|
|
userRights = CacheHelper.Get<UtilityModel.UserRights>(cacheKey);
|
|
}
|
|
else
|
|
{
|
|
LoginHelper login = new LoginHelper();
|
|
UserRights userrights = new UserRights();
|
|
userrights = login.getRights(Convert.ToDecimal(userId));
|
|
string userInfoCache = "Cache_UserInfo_" + userId.ToString();
|
|
CacheHelper.Set<UserRights>(cacheKey, userrights);
|
|
|
|
userRights.rights = userrights.rights;
|
|
// FormsAuthentication.SignOut();
|
|
}
|
|
|
|
}
|
|
return userRights.rights ?? new string[] { "-1" };
|
|
}
|
|
|
|
public static decimal[] InnerGroup(decimal[] roleId, decimal[] groupId)
|
|
{
|
|
decimal[] groups = { 0 };
|
|
string roleCodes = DataCacheHelper.GetCache().Get_RoleCodes(roleId);
|
|
if (roleCodes.IndexOf("[GLY]") > -1 || roleCodes.IndexOf("[ZJ]") > -1 || roleCodes.IndexOf("ZJZL") > -1 || roleCodes.IndexOf("[BMZG]") > -1)
|
|
{
|
|
groups = null;
|
|
}
|
|
else
|
|
{
|
|
if (groupId != null)
|
|
{
|
|
groups = groupId;
|
|
}
|
|
}
|
|
return groups;
|
|
}
|
|
|
|
|
|
}
|
|
}
|