public static void injectPermissionFilter(this Object2Json object2Json, Func <string, bool> securityCheck, bool throwException) { PermissionFilterExplorer pfe = new PermissionFilterExplorer(); pfe.ThrowException = throwException; object2Json.ExplorerFactory = () => { pfe.UnderlyingExplorer = new ObjectExplorerImpl(); pfe.CheckPermissionByName = securityCheck; return(pfe); }; }
Object2Json createSecureObjectToJson(string[] currentPermissions, bool throwPermissionOnDenial, NodeExpander nodeExpander) { Object2Json o2j = new Object2Json(); o2j.NodeExpander = nodeExpander; PermissionFilterExplorer pfe = new PermissionFilterExplorer(); pfe.ThrowException = throwPermissionOnDenial; o2j.ExplorerFactory = () => { pfe.UnderlyingExplorer = new ObjectExplorerImpl(); pfe.CheckPermissionByName = (strPermission) => { return(currentPermissions.Contains(strPermission)); }; return(pfe); }; return(o2j); }
Object2Json createSecureObjectToJson(string[] currentPermissions, bool throwPermissionOnDenial, NodeExpander nodeExpander) { Object2Json o2j = new Object2Json(); o2j.NodeExpander = nodeExpander; PermissionFilterExplorer pfe = new PermissionFilterExplorer(); pfe.ThrowException = throwPermissionOnDenial; o2j.ExplorerFactory = () => { pfe.UnderlyingExplorer = new ObjectExplorerImpl(); pfe.CheckPermissionByName = (strPermission) => { return currentPermissions.Contains(strPermission); }; return pfe; }; return o2j; }
public static void injectPermissionFilter(this Object2Json object2Json, Func<string, bool> securityCheck, bool throwException) { PermissionFilterExplorer pfe = new PermissionFilterExplorer(); pfe.ThrowException = throwException; object2Json.ExplorerFactory = () => { pfe.UnderlyingExplorer = new ObjectExplorerImpl(); pfe.CheckPermissionByName = securityCheck; return pfe; }; }