Free cookie consent management tool by TermsFeed Policy Generator

Changeset 4979


Ignore:
Timestamp:
11/28/10 15:27:04 (14 years ago)
Author:
jwolfing
Message:

#1196 Changed BaseClasses in Data Transfer Objects, added Methods to User and Role ServiceClasses

Location:
branches/UserManagement
Files:
2 added
2 deleted
14 edited

Legend:

Unmodified
Added
Removed
  • branches/UserManagement/HeuristicLab.Services.Authentication.DataTransfer/Application.cs

    r4964 r4979  
    88{
    99  [DataContract]
    10   public class Application : NamedAuthItem {
     10  public class Application : NamedAuthenticationItem {
    1111   
    1212   
    1313   
    14     [DataMember]
    15     public string LoweredApplicationName { get; set; } // !!! REMOVE
     14    //[DataMember]
     15    //public string LoweredApplicationName { get; set; } // !!! REMOVE
    1616
    1717    [DataMember]
  • branches/UserManagement/HeuristicLab.Services.Authentication.DataTransfer/HeuristicLab.Services.Authentication.DataTransfer.csproj

    r4740 r4979  
    4343  <ItemGroup>
    4444    <Compile Include="Application.cs" />
    45     <Compile Include="AuthItem.cs" />
    46     <Compile Include="NamedAuthItem.cs" />
     45    <Compile Include="AuthenticationItem.cs" />
     46    <Compile Include="NamedAuthenticationItem.cs" />
    4747    <Compile Include="Role.cs" />
    4848    <Compile Include="User.cs" />
  • branches/UserManagement/HeuristicLab.Services.Authentication.DataTransfer/Role.cs

    r4964 r4979  
    88{
    99  [DataContract]
    10   public class Role : NamedAuthItem {
     10  public class Role : NamedAuthenticationItem {
    1111
    1212      public Role()
    1313      {
    1414          Name = "";
    15           LoweredRoleName = "";
    1615      }
    1716
    1817    [DataMember]
    1918    public Guid ApplicationId { get; set; }
    20    [DataMember]
    21     public string LoweredRoleName { get; set; } // !!! REMOVE
     19    //[DataMember]
     20    //public string LoweredRoleName { get; set; } // !!! REMOVE
    2221    [DataMember]
    2322    public string Description { get; set; }
  • branches/UserManagement/HeuristicLab.Services.Authentication.DataTransfer/User.cs

    r4964 r4979  
    88{
    99  [DataContract]
    10   public class User : NamedAuthItem {
     10  public class User : NamedAuthenticationItem {
    1111
    1212      public User()
  • branches/UserManagement/HeuristicLab.Services.Authentication.ServiceClients/AuthenticationClient.cs

    r4962 r4979  
    5353        #region Store
    5454
    55         public bool Store(AuthItem item)
     55        public bool Store(AuthenticationItem item)
    5656        {
    5757            try
     
    6060                {
    6161                    if (item is Role)
    62                         item.Id = CallService<Guid>(s => s.InsertRole((Role)item));
     62                        item.Id = CallService<Guid>(s => s.AddRole((Role)item));
    6363                    else if (item is User)
    64                         item.Id = CallService<Guid>(s => s.InsertUser((User)item));
     64                        item.Id = CallService<Guid>(s => s.AddUser((User)item));
    6565                    else if (item is Application)
    66                         item.Id = CallService<Guid>(s => s.InsertApplication((Application)item));
     66                        item.Id = CallService<Guid>(s => s.AddApplication((Application)item));
    6767
    6868                }
     
    130130            AuthenticationServiceClient client = new AuthenticationServiceClient();
    131131            client.ClientCredentials.UserName.UserName = "Alice";
    132             client.ClientCredentials.UserName.Password = "YouWillKnow";
     132            client.ClientCredentials.UserName.Password = "YouWillNeverKnow";
    133133            client.ClientCredentials.ServiceCertificate.Authentication.CertificateValidationMode = X509CertificateValidationMode.None;
    134134            //AuthenticationServiceClient client = ClientFactory.Create<AuthenticationClient, IAuthenticationService>();
  • branches/UserManagement/HeuristicLab.Services.Authentication.ServiceClients/ServiceClients/AuthenticationServiceClient.cs

    r4962 r4979  
    11//------------------------------------------------------------------------------
    22// <auto-generated>
    3 //     This code was generated by a tool.
    4 //     Runtime Version:4.0.30319.1
     3//     Dieser Code wurde von einem Tool generiert.
     4//     Laufzeitversion:4.0.30319.1
    55//
    6 //     Changes to this file may cause incorrect behavior and will be lost if
    7 //     the code is regenerated.
     6//     Änderungen an dieser Datei können falsches Verhalten verursachen und gehen verloren, wenn
     7//     der Code erneut generiert wird.
    88// </auto-generated>
    99//------------------------------------------------------------------------------
     
    1616    [System.Diagnostics.DebuggerStepThroughAttribute()]
    1717    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    18     [System.Runtime.Serialization.DataContractAttribute(Name="AuthItem", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
     18    [System.Runtime.Serialization.DataContractAttribute(Name="AuthenticationItem", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
    1919        "Transfer")]
    20     [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.NamedAuthItem))]
     20    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.NamedAuthenticationItem))]
    2121    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.Role))]
    2222    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.Application))]
    2323    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.User))]
    24     public partial class AuthItem : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
     24    public partial class AuthenticationItem : object, System.Runtime.Serialization.IExtensibleDataObject, System.ComponentModel.INotifyPropertyChanged
    2525    {
    2626       
     
    7272    [System.Diagnostics.DebuggerStepThroughAttribute()]
    7373    [System.CodeDom.Compiler.GeneratedCodeAttribute("System.Runtime.Serialization", "4.0.0.0")]
    74     [System.Runtime.Serialization.DataContractAttribute(Name="NamedAuthItem", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
     74    [System.Runtime.Serialization.DataContractAttribute(Name="NamedAuthenticationItem", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
    7575        "Transfer")]
    7676    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.Role))]
    7777    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.Application))]
    7878    [System.Runtime.Serialization.KnownTypeAttribute(typeof(HeuristicLab.Services.Authentication.User))]
    79     public partial class NamedAuthItem : HeuristicLab.Services.Authentication.AuthItem
     79    public partial class NamedAuthenticationItem : HeuristicLab.Services.Authentication.AuthenticationItem
    8080    {
    8181       
     
    104104    [System.Runtime.Serialization.DataContractAttribute(Name="Role", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
    105105        "Transfer")]
    106     public partial class Role : HeuristicLab.Services.Authentication.NamedAuthItem
     106    public partial class Role : HeuristicLab.Services.Authentication.NamedAuthenticationItem
    107107    {
    108108       
     
    110110       
    111111        private string DescriptionField;
    112        
    113         private string LoweredRoleNameField;
    114112       
    115113        [System.Runtime.Serialization.DataMemberAttribute()]
     
    143141                    this.DescriptionField = value;
    144142                    this.RaisePropertyChanged("Description");
    145                 }
    146             }
    147         }
    148        
    149         [System.Runtime.Serialization.DataMemberAttribute()]
    150         public string LoweredRoleName
    151         {
    152             get
    153             {
    154                 return this.LoweredRoleNameField;
    155             }
    156             set
    157             {
    158                 if ((object.ReferenceEquals(this.LoweredRoleNameField, value) != true))
    159                 {
    160                     this.LoweredRoleNameField = value;
    161                     this.RaisePropertyChanged("LoweredRoleName");
    162143                }
    163144            }
     
    169150    [System.Runtime.Serialization.DataContractAttribute(Name="Application", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
    170151        "Transfer")]
    171     public partial class Application : HeuristicLab.Services.Authentication.NamedAuthItem
     152    public partial class Application : HeuristicLab.Services.Authentication.NamedAuthenticationItem
    172153    {
    173154       
    174155        private string DescriptionField;
    175        
    176         private string LoweredApplicationNameField;
    177156       
    178157        [System.Runtime.Serialization.DataMemberAttribute()]
     
    189168                    this.DescriptionField = value;
    190169                    this.RaisePropertyChanged("Description");
    191                 }
    192             }
    193         }
    194        
    195         [System.Runtime.Serialization.DataMemberAttribute()]
    196         public string LoweredApplicationName
    197         {
    198             get
    199             {
    200                 return this.LoweredApplicationNameField;
    201             }
    202             set
    203             {
    204                 if ((object.ReferenceEquals(this.LoweredApplicationNameField, value) != true))
    205                 {
    206                     this.LoweredApplicationNameField = value;
    207                     this.RaisePropertyChanged("LoweredApplicationName");
    208170                }
    209171            }
     
    215177    [System.Runtime.Serialization.DataContractAttribute(Name="User", Namespace="http://schemas.datacontract.org/2004/07/HeuristicLab.Services.Authentication.Data" +
    216178        "Transfer")]
    217     public partial class User : HeuristicLab.Services.Authentication.NamedAuthItem
     179    public partial class User : HeuristicLab.Services.Authentication.NamedAuthenticationItem
    218180    {
    219181       
     
    455417        HeuristicLab.Services.Authentication.User GetUser(System.Guid id);
    456418       
     419        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetAllUsers", ReplyAction="http://tempuri.org/IAuthenticationService/GetAllUsersResponse")]
     420        HeuristicLab.Services.Authentication.User[] GetAllUsers();
     421       
    457422        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetUsers", ReplyAction="http://tempuri.org/IAuthenticationService/GetUsersResponse")]
    458423        HeuristicLab.Services.Authentication.User[] GetUsers(System.Guid applicationId);
    459424       
    460         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/InsertUser", ReplyAction="http://tempuri.org/IAuthenticationService/InsertUserResponse")]
    461         System.Guid InsertUser(HeuristicLab.Services.Authentication.User user);
     425        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/AddUser", ReplyAction="http://tempuri.org/IAuthenticationService/AddUserResponse")]
     426        System.Guid AddUser(HeuristicLab.Services.Authentication.User user);
    462427       
    463428        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/DeleteUser", ReplyAction="http://tempuri.org/IAuthenticationService/DeleteUserResponse")]
     
    470435        bool AddUserToRole(System.Guid roleId, System.Guid userId);
    471436       
     437        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetUsersInRole", ReplyAction="http://tempuri.org/IAuthenticationService/GetUsersInRoleResponse")]
     438        System.Guid[] GetUsersInRole(System.Guid roleId);
     439       
    472440        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/RemoveUserFromRole", ReplyAction="http://tempuri.org/IAuthenticationService/RemoveUserFromRoleResponse")]
    473441        bool RemoveUserFromRole(System.Guid roleId, System.Guid userId);
    474442       
    475         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetRolesForUser", ReplyAction="http://tempuri.org/IAuthenticationService/GetRolesForUserResponse")]
    476         HeuristicLab.Services.Authentication.Role[] GetRolesForUser(System.Guid userId);
     443        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/IsUserInRole", ReplyAction="http://tempuri.org/IAuthenticationService/IsUserInRoleResponse")]
     444        bool IsUserInRole(System.Guid userId, System.Guid roleId);
    477445       
    478446        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetRole", ReplyAction="http://tempuri.org/IAuthenticationService/GetRoleResponse")]
    479447        HeuristicLab.Services.Authentication.Role GetRole(System.Guid id);
    480448       
     449        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetAllRoles", ReplyAction="http://tempuri.org/IAuthenticationService/GetAllRolesResponse")]
     450        HeuristicLab.Services.Authentication.Role[] GetAllRoles();
     451       
    481452        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetRoles", ReplyAction="http://tempuri.org/IAuthenticationService/GetRolesResponse")]
    482453        HeuristicLab.Services.Authentication.Role[] GetRoles(System.Guid applicationId);
    483454       
    484         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/InsertRole", ReplyAction="http://tempuri.org/IAuthenticationService/InsertRoleResponse")]
    485         System.Guid InsertRole(HeuristicLab.Services.Authentication.Role role);
     455        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/AddRole", ReplyAction="http://tempuri.org/IAuthenticationService/AddRoleResponse")]
     456        System.Guid AddRole(HeuristicLab.Services.Authentication.Role role);
    486457       
    487458        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/UpdateRole", ReplyAction="http://tempuri.org/IAuthenticationService/UpdateRoleResponse")]
     
    491462        bool DeleteRole(System.Guid id);
    492463       
    493         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetUsersInRole", ReplyAction="http://tempuri.org/IAuthenticationService/GetUsersInRoleResponse")]
    494         HeuristicLab.Services.Authentication.User[] GetUsersInRole(System.Guid roleId);
     464        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetRolesForUser", ReplyAction="http://tempuri.org/IAuthenticationService/GetRolesForUserResponse")]
     465        System.Guid[] GetRolesForUser(System.Guid userId);
    495466       
    496467        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/GetApplication", ReplyAction="http://tempuri.org/IAuthenticationService/GetApplicationResponse")]
    497468        HeuristicLab.Services.Authentication.Application GetApplication(System.Guid id);
    498469       
    499         [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/InsertApplication", ReplyAction="http://tempuri.org/IAuthenticationService/InsertApplicationResponse")]
    500         System.Guid InsertApplication(HeuristicLab.Services.Authentication.Application application);
     470        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/AddApplication", ReplyAction="http://tempuri.org/IAuthenticationService/AddApplicationResponse")]
     471        System.Guid AddApplication(HeuristicLab.Services.Authentication.Application application);
    501472       
    502473        [System.ServiceModel.OperationContractAttribute(Action="http://tempuri.org/IAuthenticationService/DeleteApplication", ReplyAction="http://tempuri.org/IAuthenticationService/DeleteApplicationResponse")]
     
    549520        }
    550521       
     522        public HeuristicLab.Services.Authentication.User[] GetAllUsers()
     523        {
     524            return base.Channel.GetAllUsers();
     525        }
     526       
    551527        public HeuristicLab.Services.Authentication.User[] GetUsers(System.Guid applicationId)
    552528        {
     
    554530        }
    555531       
    556         public System.Guid InsertUser(HeuristicLab.Services.Authentication.User user)
    557         {
    558             return base.Channel.InsertUser(user);
     532        public System.Guid AddUser(HeuristicLab.Services.Authentication.User user)
     533        {
     534            return base.Channel.AddUser(user);
    559535        }
    560536       
     
    574550        }
    575551       
     552        public System.Guid[] GetUsersInRole(System.Guid roleId)
     553        {
     554            return base.Channel.GetUsersInRole(roleId);
     555        }
     556       
    576557        public bool RemoveUserFromRole(System.Guid roleId, System.Guid userId)
    577558        {
     
    579560        }
    580561       
    581         public HeuristicLab.Services.Authentication.Role[] GetRolesForUser(System.Guid userId)
     562        public bool IsUserInRole(System.Guid userId, System.Guid roleId)
     563        {
     564            return base.Channel.IsUserInRole(userId, roleId);
     565        }
     566       
     567        public HeuristicLab.Services.Authentication.Role GetRole(System.Guid id)
     568        {
     569            return base.Channel.GetRole(id);
     570        }
     571       
     572        public HeuristicLab.Services.Authentication.Role[] GetAllRoles()
     573        {
     574            return base.Channel.GetAllRoles();
     575        }
     576       
     577        public HeuristicLab.Services.Authentication.Role[] GetRoles(System.Guid applicationId)
     578        {
     579            return base.Channel.GetRoles(applicationId);
     580        }
     581       
     582        public System.Guid AddRole(HeuristicLab.Services.Authentication.Role role)
     583        {
     584            return base.Channel.AddRole(role);
     585        }
     586       
     587        public bool UpdateRole(HeuristicLab.Services.Authentication.Role role)
     588        {
     589            return base.Channel.UpdateRole(role);
     590        }
     591       
     592        public bool DeleteRole(System.Guid id)
     593        {
     594            return base.Channel.DeleteRole(id);
     595        }
     596       
     597        public System.Guid[] GetRolesForUser(System.Guid userId)
    582598        {
    583599            return base.Channel.GetRolesForUser(userId);
    584600        }
    585601       
    586         public HeuristicLab.Services.Authentication.Role GetRole(System.Guid id)
    587         {
    588             return base.Channel.GetRole(id);
    589         }
    590        
    591         public HeuristicLab.Services.Authentication.Role[] GetRoles(System.Guid applicationId)
    592         {
    593             return base.Channel.GetRoles(applicationId);
    594         }
    595        
    596         public System.Guid InsertRole(HeuristicLab.Services.Authentication.Role role)
    597         {
    598             return base.Channel.InsertRole(role);
    599         }
    600        
    601         public bool UpdateRole(HeuristicLab.Services.Authentication.Role role)
    602         {
    603             return base.Channel.UpdateRole(role);
    604         }
    605        
    606         public bool DeleteRole(System.Guid id)
    607         {
    608             return base.Channel.DeleteRole(id);
    609         }
    610        
    611         public HeuristicLab.Services.Authentication.User[] GetUsersInRole(System.Guid roleId)
    612         {
    613             return base.Channel.GetUsersInRole(roleId);
    614         }
    615        
    616602        public HeuristicLab.Services.Authentication.Application GetApplication(System.Guid id)
    617603        {
     
    619605        }
    620606       
    621         public System.Guid InsertApplication(HeuristicLab.Services.Authentication.Application application)
    622         {
    623             return base.Channel.InsertApplication(application);
     607        public System.Guid AddApplication(HeuristicLab.Services.Authentication.Application application)
     608        {
     609            return base.Channel.AddApplication(application);
    624610        }
    625611       
  • branches/UserManagement/HeuristicLab.Services.Authentication.ServiceClients/app.config

    r4962 r4979  
    2929                name="WSHttpBinding_IAuthenticationService">
    3030                <identity>
    31                     <certificate encodedValue="AwAAAAEAAAAUAAAAAV7xMfFtgnY5+8sJyWRHHa0QvTcgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhBXQX+6QCO6m0LTqFCaKnh3MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDkyNzE5MTIxNFoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDa4H45oXaRry7PwK3dI6AJWpxyEqmDBP+SnIZelLsPfWQ1oFPqH1zygaza0ZP+Gq5kxrL2cRrS9eiq/AlacWMOFsIEM6SZ/HBsaA9IiHssv3KH4uKwjcOWP1/TwL1OlwGDJszXrGmslrdFXg6I3grFlks8nYPVmuIzwVfmUKO+nwIDAQABo0kwRzBFBgNVHQEEPjA8gBDRH5aGMOUZ99XrCILH02uuoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghBXQX+6QCO6m0LTqFCaKnh3MAkGBSsOAwIdBQADgYEAtRZiYmZ7mKH0wkDd8v+33g8KU8mFiBS26hUowCpcCvYpG23FaVXbBua+zTt45RIBcEQUVdLOdtIAMogymV4sq9JafaU2Y9Dh9gnSqOF2KplC/xyf5f+QWwCZ4Yljr9g1BizWoOE6SF1TcjL66iZ09JMwYJKO9V3iuOosnzJ8DEA=" />
     31                    <certificate encodedValue="AwAAAAEAAAAUAAAAXL2k/dCMiB3+7a8y6zepgAUMPdcgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhB0J9LOt5NHpkN1DGclpr/0MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDkyMTE4MDIwN1oXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC73VKB25OrytpquyozHwo7d711Z4KEQEWHIigtJufMBUIzpQWXQrySaYrOdjZxuDJE8M7+kUi6FJny3o48Z8ZEEIKdoy4fJ+o5+rXKKNyg3rZxae1KJm4kQ3rIRu68b3cu6EYvFymORNo+gv8A03IbA2F7K1vaQbuRDAdbP8CT+QIDAQABo0kwRzBFBgNVHQEEPjA8gBC/lrDi96sGW7ZLNecSjhFEoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghB0J9LOt5NHpkN1DGclpr/0MAkGBSsOAwIdBQADgYEAdls1HmJKAhEUZvCcg/ELZYpRHF3ds5mHsYrNNhEoUTrHYJzsXDqxLMyn9nbKQHv+kBH7tdgF61agYvy3666D7EHPMXyEk6OwCVxIvOyNaHywS0v7/fyU/394VpzFNmkuycaiemEZFhqxstKN6n4PzBqOJfUmIE9Ry/mnlp6T2Zo=" />
    3232                </identity>
    3333            </endpoint>
  • branches/UserManagement/HeuristicLab.Services.Authentication.TestClient2/Program.cs

    r4962 r4979  
    2020                Console.WriteLine(app.Name);
    2121            }
     22            Console.WriteLine("          Users         ");
     23            IEnumerable<User> users = AuthenticationClient.Instance.Users;
     24
     25            foreach (User u in users) {
     26              Console.WriteLine(u.Name);
     27            }
    2228            Console.ReadLine();
    2329
  • branches/UserManagement/HeuristicLab.Services.Authentication.TestClient2/UserManagement.cs

    r4789 r4979  
    7979                        // insert
    8080                        selectedApplication.Id = Guid.NewGuid();
    81                         auth.InsertApplication(selectedApplication);
     81                        auth.AddApplication(selectedApplication);
    8282                    }
    8383                    else
     
    127127                    selectedRole.ApplicationId = currentApplication.Id;
    128128
    129                     auth.InsertRole(selectedRole);
     129                    auth.AddRole(selectedRole);
    130130                }
    131131                else
     
    183183                    selectedUser.ApplicationId = currentApplication.Id;
    184184
    185                     auth.InsertUser(selectedUser);
     185                    auth.AddUser(selectedUser);
    186186                }
    187187                else
  • branches/UserManagement/HeuristicLab.Services.Authentication.TestClient2/app.config

    r4962 r4979  
    2929                name="WSHttpBinding_IAuthenticationService">
    3030                <identity>
    31                     <certificate encodedValue="AwAAAAEAAAAUAAAAAV7xMfFtgnY5+8sJyWRHHa0QvTcgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhBXQX+6QCO6m0LTqFCaKnh3MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDkyNzE5MTIxNFoXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQDa4H45oXaRry7PwK3dI6AJWpxyEqmDBP+SnIZelLsPfWQ1oFPqH1zygaza0ZP+Gq5kxrL2cRrS9eiq/AlacWMOFsIEM6SZ/HBsaA9IiHssv3KH4uKwjcOWP1/TwL1OlwGDJszXrGmslrdFXg6I3grFlks8nYPVmuIzwVfmUKO+nwIDAQABo0kwRzBFBgNVHQEEPjA8gBDRH5aGMOUZ99XrCILH02uuoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghBXQX+6QCO6m0LTqFCaKnh3MAkGBSsOAwIdBQADgYEAtRZiYmZ7mKH0wkDd8v+33g8KU8mFiBS26hUowCpcCvYpG23FaVXbBua+zTt45RIBcEQUVdLOdtIAMogymV4sq9JafaU2Y9Dh9gnSqOF2KplC/xyf5f+QWwCZ4Yljr9g1BizWoOE6SF1TcjL66iZ09JMwYJKO9V3iuOosnzJ8DEA=" />
     31                    <certificate encodedValue="AwAAAAEAAAAUAAAAXL2k/dCMiB3+7a8y6zepgAUMPdcgAAAAAQAAAPIBAAAwggHuMIIBW6ADAgECAhB0J9LOt5NHpkN1DGclpr/0MAkGBSsOAwIdBQAwFDESMBAGA1UEAxMJbG9jYWxob3N0MB4XDTEwMDkyMTE4MDIwN1oXDTM5MTIzMTIzNTk1OVowFDESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqGSIb3DQEBAQUAA4GNADCBiQKBgQC73VKB25OrytpquyozHwo7d711Z4KEQEWHIigtJufMBUIzpQWXQrySaYrOdjZxuDJE8M7+kUi6FJny3o48Z8ZEEIKdoy4fJ+o5+rXKKNyg3rZxae1KJm4kQ3rIRu68b3cu6EYvFymORNo+gv8A03IbA2F7K1vaQbuRDAdbP8CT+QIDAQABo0kwRzBFBgNVHQEEPjA8gBC/lrDi96sGW7ZLNecSjhFEoRYwFDESMBAGA1UEAxMJbG9jYWxob3N0ghB0J9LOt5NHpkN1DGclpr/0MAkGBSsOAwIdBQADgYEAdls1HmJKAhEUZvCcg/ELZYpRHF3ds5mHsYrNNhEoUTrHYJzsXDqxLMyn9nbKQHv+kBH7tdgF61agYvy3666D7EHPMXyEk6OwCVxIvOyNaHywS0v7/fyU/394VpzFNmkuycaiemEZFhqxstKN6n4PzBqOJfUmIE9Ry/mnlp6T2Zo=" />
    3232                </identity>
    3333            </endpoint>
  • branches/UserManagement/HeuristicLab.Services.Authentication/AuthenticationService.cs

    r4962 r4979  
    3131        }
    3232
     33        public IEnumerable<DataTransfer.User> GetAllUsers() {
     34          List<DataTransfer.User> userList = new List<DataTransfer.User>();
     35          using (UserManagementDataContext db = new UserManagementDataContext()) {
     36            var users = db.aspnet_Users.ToList<aspnet_User>();
     37            foreach (aspnet_User user in users) {
     38              var membership = db.aspnet_Memberships.Where(x => x.UserId == user.UserId).FirstOrDefault();
     39              userList.Add(Convert.ToDataTransfer(user, membership));
     40            }
     41          }
     42
     43          return userList;
     44        }
     45
    3346        public IEnumerable<DataTransfer.User> GetUsers(Guid applicationId)
    3447        {
     
    5265        }
    5366
    54         public Guid InsertUser(User user)
     67        public Guid AddUser(User user)
    5568        {
    5669            if (user != null)
     
    138151
    139152
     153        public bool AddUserToRole(Guid roleId, Guid userId) {
     154          using (UserManagementDataContext db = new UserManagementDataContext()) {
     155            try {
     156              aspnet_UsersInRole r = new aspnet_UsersInRole();
     157              r.RoleId = roleId;
     158              r.UserId = userId;
     159              db.aspnet_UsersInRoles.InsertOnSubmit(r);
     160              db.SubmitChanges();
     161              return true;
     162            }
     163            catch (Exception ex) {
     164              Debug.WriteLine(ex.InnerException);
     165              return false;
     166            }
     167          }
     168        }
     169
     170        public IEnumerable<Guid> GetUsersInRole(Guid roleId) {
     171          List<Guid> userList = new List<Guid>();
     172          using (UserManagementDataContext db = new UserManagementDataContext()) {
     173            try {
     174              var users = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId).ToList<aspnet_UsersInRole>();
     175
     176              foreach (aspnet_UsersInRole u in users) {
     177                userList.Add(GetUser(u.UserId).Id);
     178              }
     179
     180            }
     181            catch (Exception ex) {
     182              Debug.WriteLine(ex.InnerException);
     183              return new List<Guid>();
     184
     185            }
     186
     187          }
     188
     189          return userList;
     190        }
     191
     192      /*
     193        public IEnumerable<User> GetUsersInRole(Guid roleId) {
     194          List<User> userList = new List<User>();
     195          using (UserManagementDataContext db = new UserManagementDataContext()) {
     196            try {
     197              var users = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId).ToList<aspnet_UsersInRole>();
     198
     199              foreach (aspnet_UsersInRole u in users) {
     200                userList.Add(GetUser(u.UserId));
     201
     202              }
     203
     204            }
     205            catch (Exception ex) {
     206              Debug.WriteLine(ex.InnerException);
     207              return new List<User>();
     208            }
     209          }
     210
     211          return userList;
     212        }
     213       */
     214
     215        public bool IsUserInRole(Guid userId, Guid roleId) {
     216          bool isInRole = false;
     217          using (UserManagementDataContext db = new UserManagementDataContext()) {
     218            var users = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId && x.UserId == userId).ToList<aspnet_UsersInRole>();
     219            foreach (aspnet_UsersInRole u in users) {
     220              isInRole = true;
     221            }
     222          }
     223          return isInRole;
     224
     225        }
     226
     227
     228        public bool RemoveUserFromRole(Guid roleId, Guid userId) {
     229          using (UserManagementDataContext db = new UserManagementDataContext()) {
     230            try {
     231              var role = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId && x.UserId == userId).FirstOrDefault();
     232
     233              db.aspnet_UsersInRoles.DeleteOnSubmit(role);
     234              db.SubmitChanges();
     235              return true;
     236
     237            }
     238            catch (Exception ex) {
     239              Debug.WriteLine(ex.InnerException);
     240              return false;
     241            }
     242          }
     243
     244        }
     245
     246
     247
    140248
    141249        #endregion
     
    154262        }
    155263
     264        public IEnumerable<Role> GetAllRoles() {
     265          List<DataTransfer.Role> roleList = new List<DataTransfer.Role>();
     266          using (UserManagementDataContext db = new UserManagementDataContext()) {
     267            var roles = db.aspnet_Roles.ToList<aspnet_Role>();
     268            foreach (aspnet_Role role in roles) {
     269              roleList.Add(Convert.ToDataTransfer(role));
     270            }
     271          }
     272          return roleList;
     273        }
     274
    156275        public IEnumerable<Role> GetRoles(Guid applicationId)
    157276        {
     
    170289        }
    171290
    172         public Guid InsertRole(Role role)
     291        public Guid AddRole(Role role)
    173292        {
    174293
     
    220339        }
    221340
    222         public bool AddUserToRole(Guid roleId, Guid userId)
    223         {
     341        public IEnumerable<Guid> GetRolesForUser(Guid userId) {
     342          List<Guid> roleList = new List<Guid>();
     343          using (UserManagementDataContext db = new UserManagementDataContext()) {
     344            try {
     345              var roles = db.aspnet_UsersInRoles.Where(x => x.UserId == userId).ToList<aspnet_UsersInRole>();
     346              foreach (aspnet_UsersInRole r in roles) {
     347                roleList.Add(GetRole(r.RoleId).Id);
     348              }
     349            }
     350            catch (Exception ex) {
     351              Debug.WriteLine(ex.InnerException);
     352              return new List<Guid>();
     353            }
     354          }
     355
     356          return roleList;
     357
     358        }
     359
     360       /*
     361        public IEnumerable<Role> GetRolesForUser(Guid userId)
     362        {
     363            List<Role> roleList = new List<Role>();
    224364            using (UserManagementDataContext db = new UserManagementDataContext())
    225365            {
    226366                try
    227367                {
    228                     aspnet_UsersInRole r = new aspnet_UsersInRole();
    229                     r.RoleId = roleId;
    230                     r.UserId = userId;
    231                     db.aspnet_UsersInRoles.InsertOnSubmit(r);
    232                     db.SubmitChanges();
    233                     return true;
    234                 }
    235                 catch (Exception ex)
    236                 {
    237                     Debug.WriteLine(ex.InnerException);
    238                     return false;
    239                 }
    240             }
    241         }
    242 
    243         public bool RemoveUserFromRole(Guid roleId, Guid userId)
    244         {
    245             using (UserManagementDataContext db = new UserManagementDataContext())
    246             {
    247                 try
    248                 {
    249                     var role = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId && x.UserId == userId).FirstOrDefault();
    250 
    251                     db.aspnet_UsersInRoles.DeleteOnSubmit(role);
    252                     db.SubmitChanges();
    253                     return true;
    254 
    255                 }
    256                 catch (Exception ex)
    257                 {
    258                     Debug.WriteLine(ex.InnerException);
    259                     return false;
    260                 }
    261             }
    262 
    263         }
    264 
    265         public IEnumerable<Role> GetRolesForUser(Guid userId)
    266         {
    267             List<Role> roleList = new List<Role>();
    268             using (UserManagementDataContext db = new UserManagementDataContext())
    269             {
    270                 try
    271                 {
    272                     var roles = db.aspnet_UsersInRoles.Where(x => x.UserId == userId).ToList<aspnet_UsersInRole>();
     368                    var roles = db.aspnet_UsersInRoles.Where(x => x.UserId == userId).ToList<aspnet_UsersINRole>();
    273369
    274370                    foreach (aspnet_UsersInRole r in roles)
     
    288384            return roleList;
    289385        }
    290 
    291         public IEnumerable<User> GetUsersInRole(Guid roleId)
    292         {
    293             List<User> userList = new List<User>();
    294             using (UserManagementDataContext db = new UserManagementDataContext())
    295             {
    296                 try
    297                 {
    298                     var users = db.aspnet_UsersInRoles.Where(x => x.RoleId == roleId).ToList<aspnet_UsersInRole>();
    299 
    300                     foreach (aspnet_UsersInRole u in users)
    301                     {
    302                         userList.Add(GetUser(u.UserId));
    303 
    304                     }
    305 
    306                 }
    307                 catch (Exception ex)
    308                 {
    309                     Debug.WriteLine(ex.InnerException);
    310                     return new List<User>();
    311                 }
    312             }
    313 
    314             return userList;
    315         }
     386         */
    316387
    317388
     
    353424        #region Application
    354425
    355         public Guid InsertApplication(Application application)
     426        public Guid AddApplication(Application application)
    356427        {
    357428            if (application != null)
  • branches/UserManagement/HeuristicLab.Services.Authentication/Convert.cs

    r4926 r4979  
    9292                Id = source.ApplicationId,
    9393                Name = source.ApplicationName,
    94                 LoweredApplicationName = source.LoweredApplicationName,
     94                //LoweredApplicationName = source.LoweredApplicationName,
    9595                Description = source.Description
    9696            };
     
    108108                target.ApplicationId = source.Id;
    109109                target.ApplicationName = source.Name;
    110                 target.LoweredApplicationName = source.LoweredApplicationName;
     110                target.LoweredApplicationName = source.Name.ToLower();
    111111                target.Description = source.Description;
    112112            }
     
    132132                Name = source.RoleName,
    133133                Description = source.Description,
    134                 LoweredRoleName = source.LoweredRoleName,
     134                //LoweredRoleName = source.LoweredRoleName,
    135135            };
    136136        }
     
    148148                target.RoleId = source.Id;
    149149                target.RoleName = source.Name;
    150                 target.LoweredRoleName = source.LoweredRoleName;
     150                target.LoweredRoleName = source.Name.ToLower();
    151151                target.Description = source.Description;
    152152            }
  • branches/UserManagement/HeuristicLab.Services.Authentication/Interfaces/IAuthenticationService.cs

    r4964 r4979  
    1515        User GetUser(Guid id);
    1616
    17 
    18         // IEnumerable<User> GetUsers();
     17        [OperationContract]
     18        IEnumerable<User> GetAllUsers();
    1919
    2020        [OperationContract]
     
    2222
    2323        [OperationContract]
    24         Guid InsertUser(User user);         // => AddUser
     24        Guid AddUser(User user);       
    2525
    2626        [OperationContract]
     
    3434
    3535        [OperationContract]
     36        IEnumerable<Guid> GetUsersInRole(Guid roleId);
     37
     38        //[OperationContract]
     39        //IEnumerable<User> GetUsersInRole(Guid roleId); // return = Guid
     40
     41        [OperationContract]
    3642        bool RemoveUserFromRole(Guid roleId, Guid userId);
    3743
    3844        [OperationContract]
    39         IEnumerable<Role> GetRolesForUser(Guid userId);  // returnvalue = GUID
    40 
    41 
    42       // IsUserInRole
    43       //
     45        bool IsUserInRole(Guid userId, Guid roleId);
    4446
    4547        #endregion
     
    5052        Role GetRole(Guid id);
    5153
    52 
    53         //IEnumerable<Role> GetRoles();
     54        [OperationContract]
     55        IEnumerable<Role> GetAllRoles();
    5456
    5557        [OperationContract]
     
    5759
    5860        [OperationContract]
    59         Guid InsertRole(Role role); // Add
     61        Guid AddRole(Role role);
    6062
    6163        [OperationContract]
     
    6567        bool DeleteRole(Guid id);
    6668
     69
    6770        [OperationContract]
    68         IEnumerable<User> GetUsersInRole(Guid roleId); // return = Guid
     71        IEnumerable<Guid> GetRolesForUser(Guid userId);
     72
     73
     74        //[OperationContract]
     75        //IEnumerable<Role> GetRolesForUser(Guid userId);  // returnvalue = GUID
    6976
    7077        #endregion
     
    7683
    7784        [OperationContract]
    78         Guid InsertApplication(Application application); // ADD
     85        Guid AddApplication(Application application); // ADD
    7986
    8087        [OperationContract]
Note: See TracChangeset for help on using the changeset viewer.