Create user and assign it to role/group |
This examples show how you can create user and how to assign user to groups or roles.
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class Examples { static public User CreateUser(Organization org, string userName) { NewUser createUser = new NewUser(); createUser.DbName = userName; createUser.Name = userName; createUser.Email = string.Format("email{0}@tstes.st", createUser.DbName); createUser.NetworkId = ""; createUser.Password = "password"; return org.PostToUserInfoRelationForUser(createUser); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class Examples { static public void AssignUserToRole(User user, Role role) { //Add user to the role user.PutToRolesRelationForString(new AssignmentOperation { OperationType = AssignmentOperationType.Add, Ids = new List<string>() { role.Id } }); //Remove user form the role user.PutToRolesRelationForString(new AssignmentOperation { OperationType = AssignmentOperationType.Remove, Ids = new List<string>() { role.Id } }); } } }
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using DocuWare.Platform.ServerClient; namespace DocuWare.PlatformClientExamples { static partial class Examples { static public void AssignUserToGroup(User user, Group group) { //Add user to the group user.PutToGroupsRelationForString(new AssignmentOperation { OperationType = AssignmentOperationType.Add, Ids = new List<string>() { group.Id } }); //Remove user form the group user.PutToGroupsRelationForString(new AssignmentOperation { OperationType = AssignmentOperationType.Remove, Ids = new List<string>() { group.Id } }); } } }