public dynamic RegisterPublic([FromBody] IncomingProjectAccount request)
        {
            dynamic cResult = new System.Dynamic.ExpandoObject();

            using (var context = new UsersContext(Context, Configuration))
            {
                var result = context.CheckProjectSignUpPolicy(request.ProjectId, request.email);
                if (result.Item1 && !result.Item2)
                {
                    request.accountRights = new OutgoingUserAccounts
                    {
                        ChatChannels       = 1,
                        EditUserRights     = 0,
                        IterationOptions   = 0,
                        ScheduleManagement = 0,
                        ViewWorkItems      = 1,
                        WorkItemOption     = 1,
                        Documentation      = 0
                    };
                    context.AddProjectInvitation(request);
                    cResult.Success = true;
                    return(cResult);
                }
                else
                {
                    cResult.Error      = result.Item1;
                    cResult.EmailError = result.Item2;
                    return(cResult);
                }
            }
        }
示例#2
0
        public IActionResult ManageAccounts(int id)
        {
            using (var context = new UsersContext(Context, Configuration))
            {
                var domain = Request.Host.Host;
                var policy = context.CheckProjectSignUpPolicy(id, string.Empty).Item1;
                ViewData["SignupPolicy"] = policy ? 1 : 0;
                ViewData["PublicUrl"]    = policy == true ? $"https://{domain}/Accounts/ProjectSignup?projectId={id}" : "";
                ViewData["UserAccounts"] = context.GetUserAccounts();
                ViewData["ProjectId"]    = id;
            }


            return(View());
        }
        public dynamic RequestAccess([FromBody] IncomingProjectAccount request)
        {
            dynamic cResult = new System.Dynamic.ExpandoObject();

            using (var context = new UsersContext(Context, Configuration))
            {
                var result = context.CheckProjectSignUpPolicy(request.ProjectId, string.Empty).Item1;
                if (result == true)
                {
                    var getUserAccountByEmail = context.GetUserAccountByName(request.email);
                    context.AssociatedProjectExistingMembers(new IncomingExistingProjectMembers {
                        ProjectId = request.ProjectId,
                        Accounts  = new List <OutgoingUserAccounts>
                        {
                            new OutgoingUserAccounts
                            {
                                AccountId          = getUserAccountByEmail.Id,
                                ChatChannels       = 1,
                                EditUserRights     = 0,
                                IterationOptions   = 0,
                                ScheduleManagement = 0,
                                ViewWorkItems      = 1,
                                WorkItemOption     = 1,
                                Documentation      = 0
                            }
                        }
                    });
                    cResult.Success = true;
                    return(cResult);
                }
                else
                {
                    cResult.Error = true;
                    return(cResult);
                }
            }
        }