예제 #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;
 }