コード例 #1
0
ファイル: UserRole.cs プロジェクト: AsliMotor/AMQ
 private void assertValidUserAndRole(Users user, Role role)
 {
     user.ReportIfNull("User cannot be null");
     role.ReportIfNull("Role cannot be null");
     if (user.ApplicationName != role.ApplicationName)
         throw new Exception(String.Format("Cannot add user {0} of {1} to {2} of {3}, because different application name", user, user.ApplicationName, role, role.ApplicationName));
 }
コード例 #2
0
        public override void CreateRole(string rolename)
        {
            if (RoleExists(rolename))
                throw new Exception(String.Format("Role {0} already exists.", rolename));

            var role = new Role(rolename, ApplicationName);
            _reportingRepository.Save<Role>(role);
        }
コード例 #3
0
ファイル: UserRole.cs プロジェクト: AsliMotor/AMQ
 public UserRole(Users user, Role role)
     : base(Guid.NewGuid(), user.Name, role.ApplicationName)
 {
     assertValidUserAndRole(user, role);
     UserId = user.Id;
     UserName = user.Name;
     RoleId = role.Id;
     RoleName = role.Name;
     this.ApplicationName = role.ApplicationName;
 }