Esempio n. 1
0
        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);
        }
Esempio n. 2
0
 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;
 }
Esempio n. 3
0
 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();
 }
Esempio n. 8
0
 public IQueryable<IUser> ListUsersForOrganisation(IUserOrg organisation)
 {
     return PolymorphicNavigator.FindOwners<UserOrganisationLink, IUserOrg, UserDetails>(organisation);
 }
Esempio n. 9
0
 public bool CurrentUserCanActFor(IUserOrg organisation)
 {
     return CurrentUser().CanActFor(organisation);
 }
Esempio n. 10
0
 public IUser AddUser(string userName, IUserOrg toOrg)
 {
     UserDetails user = FindByUserName(userName);
     user.AddOrganisation(toOrg);
     return user;
 }