private static bool IsAuthorized(string fqn, ResourceTypes type, Guid guid) { var name = default(string); var asAppPool = ConnectionClass.ConnectAsAppPool; if (!asAppPool) { ConnectionClass.ConnectAsAppPool = true; } var client = ConnectionClass.GetFormsClient(); if (!asAppPool) { ConnectionClass.ConnectAsAppPool = false; } var identities = IdentityResolver.GetIdentities(fqn); var rules = RuleProvider.GetRules(); switch (type) { case ResourceTypes.View: { // Uses internal caches var details = client.GetForm(guid); if (details != null) { name = details.Name; } } break; case ResourceTypes.Form: { // Uses internal caches var details = client.GetForm(guid); if (details != null) { name = details.Name; } } break; default: throw new NotSupportedException(type.ToString()); } if (!string.IsNullOrEmpty(name)) { return(rules.IsAuthorized(name, type, identities)); } else { return(false); } }