private ProjectUserRole AddUserRole(ProjectUser projectUser, ProjectRole projectRole) { var projectUserRole = new ProjectUserRole(); projectUserRole.ProjectUser = projectUser; projectUserRole.ProjectRole = projectRole; Repository.Add(projectUserRole); return(projectUserRole); }
public Task <User> AddProjectMembershipAsync(User user, string projectId, ProjectUserRole role, IDictionary <string, string> properties) { return(AddProjectMembershipAsync(user, new ProjectMembership { ProjectId = projectId, Role = role, Properties = properties ?? new Dictionary <string, string>() })); }
public async Task <bool> AddProjectUserRole(ProjectUserRole pur) { try { await _db.Set <ProjectUserRole>().AddAsync(pur); } catch (Exception e) { return(false); } return(true); }
public ProjectUserRoleDTO GetLink(int?id) { ProjectUserRole link = Database.Links.Get(id.Value); if (link != null) { var mapper = new MapperConfiguration(cfg => cfg.CreateMap <ProjectUserRole, ProjectUserRoleDTO>()).CreateMapper(); return(mapper.Map <ProjectUserRole, ProjectUserRoleDTO>(link)); } else { throw new Exception("Not Found!"); } }
public bool Delete(int?id) { ProjectUserRole link = Database.Links.Get(id.Value); if (link != null) { Database.Links.Delete(id.Value); Database.Save(); return(true); } else { return(false); } }
public static User EnsureProjectMembership(this User user, string projectId, ProjectUserRole role, IDictionary <string, string> properties = null) { if (user is null) { throw new ArgumentNullException(nameof(user)); } if (projectId is null) { throw new ArgumentNullException(nameof(projectId)); } return(user.EnsureProjectMembership(new ProjectMembership { ProjectId = projectId, Role = role, Properties = properties ?? new Dictionary <string, string>() })); }
public static string PolicyRoleName(this ProjectUserRole role) => $"Project_{role}";
internal static Guid ToRoleDefinitionId(this ProjectUserRole projectUserRole) => projectUserRole switch {
public static string AuthPolicy(this ProjectUserRole role) => $"Project{role}";