コード例 #1
0
        public ActionResult CreateInvitation(int projectID, [Bind(Prefix = "CreateModel")] CreateInvitationModel model)
        {
            if (ModelState.IsValid)
            {
                CreateInvitationStatus status = InvitationService.InviteToProject(projectID, model.TargetUserPublicIdentifier, model.Type);
                switch (status)
                {
                case CreateInvitationStatus.Created:
                    ShowMessage((L)"Invitation created.");
                    return(RedirectToAction("Invitations", new { projectID = projectID }));

                case CreateInvitationStatus.UpdatedExisting:
                    ShowMessage((L)"Existing invitation was updated.");
                    return(RedirectToAction("Invitations", new { projectID = projectID }));

                case CreateInvitationStatus.NotOwner:
                    ShowMessage((L)"You're not owner! Only project owner can create invitations.", HtmlMessageType.Warning);
                    return(RedirectToAction("index"));

                case CreateInvitationStatus.AlreadyExists:
                    ShowMessage((L)"Invitation already exists.", HtmlMessageType.Warning);
                    return(RedirectToAction("Invitations", new { projectID = projectID }));

                case CreateInvitationStatus.NoSuchProject:
                    ShowMessage((L)"No such project.", HtmlMessageType.Warning);
                    return(RedirectToAction("index"));

                case CreateInvitationStatus.NoSuchUser:
                    ShowMessage((L)"Target user doesn't exist.", HtmlMessageType.Warning);
                    return(RedirectToAction("Invitations", new { projectID = projectID }));
                }
            }

            return(RedirectToAction("Invitations", new { projectID = projectID }));
        }
コード例 #2
0
 /// <summary>
 /// Invites a user to the current account
 /// </summary>
 /// <remarks>
 /// Invites a person to the current account with the requested roles and
 /// properties.&lt;br /&gt;
 /// When you specify 'IsAccountAdmin', the user will automatically have access
 /// to all properties in all roles.&lt;br /&gt;
 /// The &lt;i&gt;user&lt;/i&gt; will only be created or linked to the account,
 /// when the person accepts the invitation.&lt;br&gt;Scopes required:
 /// 'identity:account-users.manage'.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='request'>
 /// </param>
 public static MessageItemCollection ApiAccountInvitationsPost(this IIdentityApi operations, CreateInvitationModel request = default(CreateInvitationModel))
 {
     return(operations.ApiAccountInvitationsPostAsync(request).GetAwaiter().GetResult());
 }
コード例 #3
0
 /// <summary>
 /// Invites a user to the current account
 /// </summary>
 /// <remarks>
 /// Invites a person to the current account with the requested roles and
 /// properties.&lt;br /&gt;
 /// When you specify 'IsAccountAdmin', the user will automatically have access
 /// to all properties in all roles.&lt;br /&gt;
 /// The &lt;i&gt;user&lt;/i&gt; will only be created or linked to the account,
 /// when the person accepts the invitation.&lt;br&gt;Scopes required:
 /// 'identity:account-users.manage'.
 /// </remarks>
 /// <param name='operations'>
 /// The operations group for this extension method.
 /// </param>
 /// <param name='request'>
 /// </param>
 /// <param name='cancellationToken'>
 /// The cancellation token.
 /// </param>
 public static async Task <MessageItemCollection> ApiAccountInvitationsPostAsync(this IIdentityApi operations, CreateInvitationModel request = default(CreateInvitationModel), CancellationToken cancellationToken = default(CancellationToken))
 {
     using (var _result = await operations.ApiAccountInvitationsPostWithHttpMessagesAsync(request, null, cancellationToken).ConfigureAwait(false))
     {
         return(_result.Body);
     }
 }