Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fixed bug when a role name or description has a space #11

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions Connect.DNN.Powershell/Core/Commands/RoleCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,8 @@ public static RoleModelBase[] ListRoles(Data.Site site, int portalId)
}
public static RoleModel NewRole(Data.Site site, int portalId, string roleName, string description, bool? isPublic, bool? autoAssign, RoleStatus? status)
{
var cmd = string.Format("new-role --name {0}", roleName);
cmd += string.IsNullOrEmpty(description) ? "" : string.Format(" --description {0}", description);
var cmd = string.Format("new-role --name \"{0}\"", roleName);
cmd += string.IsNullOrEmpty(description) ? "" : string.Format(" --description \"{0}\"", description);
cmd += isPublic == null ? "" : string.Format(" --public {0}", isPublic);
cmd += autoAssign == null ? "" : string.Format(" --autoassign {0}", autoAssign);
cmd += status == null ? "" : string.Format(" --status {0}", status.ToString());
Expand Down
2 changes: 1 addition & 1 deletion Connect.DNN.Powershell/Core/Commands/UserCommands.cs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class UserCommands
{
public static UserRoleModel[] AddRoles(Data.Site site, int portalId, int userId, string roles, System.DateTime? start, System.DateTime? end)
{
var cmd = string.Format("add-roles --id {0} --roles {1}", userId, roles);
var cmd = string.Format("add-roles --id {0} --roles \"{1}\"", userId, roles);
cmd += start == null ? "" : string.Format(" --start {0:yyyy-MM-dd}", start);
cmd += end == null ? "" : string.Format(" --start {0:yyyy-MM-dd}", end);
var response = DnnPromptController.ProcessCommand(site, portalId, 5, cmd);
Expand Down