private byte[] SrvcPropResHandler(NameValueCollection boundVariables, string outputFormat, string requestProperties, out string responseProperties) { responseProperties = "{\"Content-Type\" : \"application/json\"}"; IPropertySet pPropSet = SOIBase.QueryConfigurationProperties(this.soHelper.ServerObject.ConfigurationName, this.soHelper.ServerObject.TypeName); JSONObject jo = new JSONObject(); jo.AddString("MaxRecordCount", pPropSet.GetProperty("MaxRecordCount").ToString()); jo.AddString("MaxImageHeight", pPropSet.GetProperty("MaxImageHeight").ToString()); jo.AddString("MaxImageWidth", pPropSet.GetProperty("MaxImageWidth").ToString()); jo.AddString("PhysicalOutputDirectory", pPropSet.GetProperty("outputDir").ToString()); jo.AddString("PhysicalCacheDirectory", pPropSet.GetProperty("cacheDir").ToString()); JSONObject result = new JSONObject(); result.AddJSONObject("serviceproperties", jo); return(Encoding.UTF8.GetBytes(result.ToJSONString(null))); }
/// <summary> /// /// </summary> /// <param name="soi"></param> /// <returns></returns> private HashSet<string> GetAuthorizedLayers ( SOIBase soi ) { var userRoleSet = soi.GetRoleInformation(soi.ServerEnvironment.UserInfo); HashSet<String> authorizedLayerSet = null; if (null == userRoleSet) return authorizedLayerSet; /* * Generate a set of authorized layers for the user */ var fullServiceName = _serverObject.ConfigurationName + "." + _serverObject.TypeName; var removeSpacesRegEx = new Regex("\\s+"); var authorizedRoles = userRoleSet.Where(role=>_servicePermissionMap.ContainsKey(fullServiceName + "." + role)); var authorizedLayerList = authorizedRoles.SelectMany(role => removeSpacesRegEx. Replace(_servicePermissionMap[fullServiceName + "." + role], ""). Split(',')); return new HashSet<string>(authorizedLayerList); }