public bool CanActFor(IUserOrg organisation) { //TODO: Make more efficient by searching on links string typeCode = PolymorphicNavigator.GetType(organisation); int orgId = organisation.Id; return(OrganisationLinks.SingleOrDefault(x => x.AssociatedRoleObjectId == orgId && x.AssociatedRoleObjectType == typeCode) != null); }
public bool CanAddUser(string userName, IUserOrg toOrg, out string errorMessage) { IUser user = FindByUserName(userName); if (user == null) { errorMessage = "UserName " + userName + " has no UserDetails object"; return false; } if (user.CanActFor(toOrg)) { errorMessage = "User is already associated with the organisation"; return false; } errorMessage = null; return true; }
public void RemoveOrganisation(IUserOrg organisation) { PolymorphicNavigator.RemoveLink <UserOrganisationLink, IUserOrg, UserDetails>(organisation, this); }
public bool CurrentUserCanActFor(IUserOrg organisation) { throw new NotImplementedException(); }
public IQueryable <IUser> ListUsersForOrganisation(IUserOrg organisation) { throw new NotImplementedException(); }
public IUser AddUser(string userName, IUserOrg toOrg) { throw new NotImplementedException(); }
public bool CanAddUser(string userName, IUserOrg toOrg, out string errorMessage) { throw new NotImplementedException(); }
public IQueryable<IUser> ListUsersForOrganisation(IUserOrg organisation) { return PolymorphicNavigator.FindOwners<UserOrganisationLink, IUserOrg, UserDetails>(organisation); }
public bool CurrentUserCanActFor(IUserOrg organisation) { return CurrentUser().CanActFor(organisation); }
public IUser AddUser(string userName, IUserOrg toOrg) { UserDetails user = FindByUserName(userName); user.AddOrganisation(toOrg); return user; }