コード例 #1
0
        internal virtual System.Func <int, bool> GetPropertyPermissions(ISet <string> roles, System.Func <string, int> tokenLookup)
        {
            if (_propertyAuthorization)
            {
//JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final':
//ORIGINAL LINE: final org.eclipse.collections.api.set.primitive.MutableIntSet blackListed = new org.eclipse.collections.impl.set.mutable.primitive.IntHashSet();
                MutableIntSet blackListed = new IntHashSet();
                foreach (string role in roles)
                {
                    if (_roleToPropertyBlacklist.ContainsKey(role))
                    {
                        Debug.Assert(_roleToPropertyBlacklist[role] != null, "Blacklist has to contain properties");
                        foreach (string propName in _roleToPropertyBlacklist[role])
                        {
                            try
                            {
                                blackListed.add(tokenLookup(propName));
                            }
                            catch (Exception)
                            {
                                _securityLog.error("Error in setting up property permissions, '" + propName + "' is not a valid property name.");
                            }
                        }
                    }
                }
                return(property => !blackListed.contains(property));
            }
            else
            {
                return(property => true);
            }
        }