internal static FieldPermission GetFieldPermission(Guid fieldGuid) { FieldPermission r = null; if (mUserFieldPermissions == null) { lock (_lock) { if (mUserFieldPermissions == null) { mUserFieldPermissions = new Dictionary <Guid, CacheObject <FieldPermission> >(); } } } if (mUserFieldPermissions != null) { if (mUserFieldPermissions.ContainsKey(fieldGuid)) { r = mUserFieldPermissions[fieldGuid].Item; } else { r = new FieldPermission(UserRoleGuid, fieldGuid); if (!Objectbase.IsNullOrEmpty(r)) { mUserFieldPermissions.Add(fieldGuid, new CacheObject <FieldPermission>(r)); } } } return(r); }
public static bool CanFieldView(Guid fieldGuid) { if (IsAdministrator) { return(true); } else { FieldPermission p = GetFieldPermission(fieldGuid); return(Objectbase.IsNullOrEmpty(p) ? false : p.CanView); } }