Changeset 2070


Ignore:
Timestamp:
06/19/09 14:15:12 (12 years ago)
Author:
mbecirov
Message:

#586: Fixed copy location of permission resource files.

Location:
trunk/sources
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/sources/HeuristicLab.Hive.Server.Core/3.2/Authorization/HivePermissions.cs

    r2065 r2070  
    66using HeuristicLab.Security.Contracts.BusinessObjects;
    77using System.Diagnostics;
     8using System.Xml;
     9using System.IO;
     10using System.Reflection;
    811
    912namespace HeuristicLab.Hive.Server.Core  {
    1013 
    1114  public static class HivePermissions {
    12     private const string PERMISSIONFILE = "Authorization//HivePermissionSet.xml";
    13     private const string POLICIESFILE = "Authorization//HivePermissionPolicy.xml";
     15    private const string PERMISSIONFILE = @"plugins\HivePermissionSet.xml";
     16    private const string POLICIESFILE = @"plugins\HivePermissionPolicy.xml";
    1417
    1518    public static class Jobmanagement {
     
    144147      Permission p = null;
    145148      XPathDocument doc;
     149      string assemblyName = Assembly.GetAssembly(typeof(HivePermissions)).GetName().Name;
    146150      doc = new XPathDocument(filename);
    147151      XPathNavigator nav = doc.CreateNavigator();
     
    164168      } while (nav.MoveToFollowing(XPathNodeType.Element));
    165169    }
    166 
     170    /*
     171    public static XmlDocument GetEmbeddedXml(Type type, string fileName) {
     172      Stream str = GetEmbeddedFile(type, fileName);
     173      XmlTextReader tr = new XmlTextReader(str);
     174      XmlDocument xml = new XmlDocument();
     175      xml.Load(tr);
     176      return xml;
     177    }
     178    */
     179
     180    /// <summary>
     181    /// Extracts an embedded file out of a given assembly.
     182    /// </summary>
     183    /// <param name="assemblyName">The namespace of you assembly.</param>
     184    /// <param name="fileName">The name of the file to extract.</param>
     185    /// <returns>A stream containing the file data.</returns>
     186    public static Stream GetEmbeddedFile(string assemblyName, string fileName) {
     187      try {
     188        Assembly a = Assembly.Load(assemblyName);
     189        Stream str = a.GetManifestResourceStream(assemblyName + "." + fileName);
     190
     191        if (str == null)
     192          throw new Exception("Could not locate embedded resource '" + fileName + "' in assembly '" + assemblyName + "'");
     193        return str;
     194      }
     195      catch (Exception e) {
     196        throw new Exception(assemblyName + ": " + e.Message);
     197      }
     198    }
     199
     200   
    167201    /// <summary>
    168202    /// Policy
     
    172206    private static void LoadFromXml(IList<Policy> policyList, string filename) {
    173207      PermissionCollection permissionCollection = GetPermissions();
     208      string assemblyName = Assembly.GetAssembly(typeof(HivePermissions)).GetName().Name;
    174209      XPathDocument doc = new XPathDocument(filename);
    175210      XPathNavigator nav = doc.CreateNavigator();
  • trunk/sources/HeuristicLab.Hive.Server.Core/3.2/HeuristicLab.Hive.Server.Core-3.2.csproj

    r2065 r2070  
    162162  </ItemGroup>
    163163  <ItemGroup>
    164     <Content Include="Authorization\HivePermissionPolicy.xml" />
     164    <EmbeddedResource Include="Authorization\HivePermissionPolicy.xml">
     165      <CopyToOutputDirectory>Always</CopyToOutputDirectory>
     166    </EmbeddedResource>
    165167  </ItemGroup>
    166168  <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  • trunk/sources/HeuristicLab/CopyAssemblies.cmd

    r2058 r2070  
    124124copy "%SolutionDir%\HeuristicLab.Security.ADODataAccess\3.2\%Outdir%\HeuristicLab.Security.ADODataAccess-3.2.dll" .\plugins
    125125copy "%SolutionDir%\HeuristicLab.Security.Server\3.2\%Outdir%\HeuristicLab.Security.Server-3.2.dll" .\plugins
    126 
     126copy "%SolutionDir%\HeuristicLab.Hive.Server.Core\3.2\%Outdir%\Authorization\*.xml" .\plugins
    127127echo "Platform: %Platform%, architecture: %PROCESSOR_ARCHITECTURE%"
    128128if "%Platform%" == "x86" (   
Note: See TracChangeset for help on using the changeset viewer.