Skip to content

Commit

Permalink
Merge pull request #499 from zharkovstas/master
Browse files Browse the repository at this point in the history
Add GetMyEmployee method and CanDeleteRestoreDocuments flag
  • Loading branch information
zharkovstas committed Jul 9, 2019
2 parents 0713f79 + f97639c commit fefe7d1
Show file tree
Hide file tree
Showing 9 changed files with 51 additions and 7 deletions.
1 change: 1 addition & 0 deletions proto/OrganizationUserPermissions.proto
Expand Up @@ -20,6 +20,7 @@ message OrganizationUserPermissions {
optional string JobTitle = 10;
required bool CanCreateDocuments = 11;
required AuthorizationPermission AuthorizationPermission = 12;
required bool CanDeleteRestoreDocuments = 13;
}

message AuthorizationPermission {
Expand Down
5 changes: 5 additions & 0 deletions src/ComDiadocApi.cs
Expand Up @@ -601,6 +601,11 @@ public void DeleteEmployee(string authToken, string boxId, string userId)
diadoc.DeleteEmployee(authToken, boxId, userId);
}

public Employee GetMyEmployee(string authToken, string boxId)
{
return diadoc.GetMyEmployee(authToken, boxId);
}

public EmployeeSubscriptions GetSubscriptions(string authToken, string boxId, string userId)
{
return diadoc.GetSubscriptions(authToken, boxId, userId);
Expand Down
7 changes: 7 additions & 0 deletions src/DiadocApi.Async.cs
Expand Up @@ -1077,6 +1077,13 @@ public Task DeleteEmployeeAsync(string authToken, string boxId, string userId)
return diadocHttpApi.DeleteEmployeeAsync(authToken, boxId, userId);
}

public Task<Employee> GetMyEmployeeAsync(string authToken, string boxId)
{
if (authToken == null) throw new ArgumentNullException("authToken");
if (boxId == null) throw new ArgumentNullException("boxId");
return diadocHttpApi.GetMyEmployeeAsync(authToken, boxId);
}

public Task<EmployeeSubscriptions> GetSubscriptionsAsync(string authToken, string boxId, string userId)
{
if (authToken == null) throw new ArgumentNullException("authToken");
Expand Down
7 changes: 7 additions & 0 deletions src/DiadocApi.cs
Expand Up @@ -1141,6 +1141,13 @@ public void DeleteEmployee(string authToken, string boxId, string userId)
diadocHttpApi.DeleteEmployee(authToken, boxId, userId);
}

public Employee GetMyEmployee(string authToken, string boxId)
{
if (authToken == null) throw new ArgumentNullException("authToken");
if (boxId == null) throw new ArgumentNullException("boxId");
return diadocHttpApi.GetMyEmployee(authToken, boxId);
}

public EmployeeSubscriptions GetSubscriptions(string authToken, string boxId, string userId)
{
if (authToken == null) throw new ArgumentNullException("authToken");
Expand Down
7 changes: 7 additions & 0 deletions src/DiadocHttpApi.Employees.Async.cs
Expand Up @@ -62,5 +62,12 @@ public Task<EmployeeSubscriptions> UpdateSubscriptionsAsync(string authToken, st
queryString.AddParameter("userId", userId);
return PerformHttpRequestAsync<SubscriptionsToUpdate, EmployeeSubscriptions>(authToken, queryString.BuildPathAndQuery(), subscriptionsToUpdate);
}

public Task<Employee> GetMyEmployeeAsync(string authToken, string boxId)
{
var queryString = new PathAndQueryBuilder("/GetMyEmployee");
queryString.AddParameter("boxId", boxId);
return PerformHttpRequestAsync<Employee>(authToken, "GET", queryString.BuildPathAndQuery());
}
}
}
7 changes: 7 additions & 0 deletions src/DiadocHttpApi.Employees.cs
Expand Up @@ -61,5 +61,12 @@ public EmployeeSubscriptions UpdateSubscriptions(string authToken, string boxId,
queryString.AddParameter("userId", userId);
return PerformHttpRequest<SubscriptionsToUpdate, EmployeeSubscriptions>(authToken, queryString.BuildPathAndQuery(), subscriptionsToUpdate);
}

public Employee GetMyEmployee(string authToken, string boxId)
{
var queryString = new PathAndQueryBuilder("/GetMyEmployee");
queryString.AddParameter("boxId", boxId);
return PerformHttpRequest<Employee>(authToken, "GET", queryString.BuildPathAndQuery());
}
}
}
2 changes: 2 additions & 0 deletions src/IDiadocApi.cs
Expand Up @@ -201,6 +201,7 @@ public interface IDiadocApi
Employee CreateEmployee(string authToken, string boxId, EmployeeToCreate employeeToCreate);
Employee UpdateEmployee(string authToken, string boxId, string userId, EmployeeToUpdate employeeToUpdate);
void DeleteEmployee(string authToken, string boxId, string userId);
Employee GetMyEmployee(string authToken, string boxId);
EmployeeSubscriptions GetSubscriptions(string authToken, string boxId, string userId);
EmployeeSubscriptions UpdateSubscriptions(string authToken, string boxId, string userId, SubscriptionsToUpdate subscriptionsToUpdate);

Expand Down Expand Up @@ -372,6 +373,7 @@ public interface IDiadocApi
Task<Employee> CreateEmployeeAsync(string authToken, string boxId, EmployeeToCreate employeeToCreate);
Task<Employee> UpdateEmployeeAsync(string authToken, string boxId, string userId, EmployeeToUpdate employeeToUpdate);
Task DeleteEmployeeAsync(string authToken, string boxId, string userId);
Task<Employee> GetMyEmployeeAsync(string authToken, string boxId);
Task<EmployeeSubscriptions> GetSubscriptionsAsync(string authToken, string boxId, string userId);
Task<EmployeeSubscriptions> UpdateSubscriptionsAsync(string authToken, string boxId, string userId, SubscriptionsToUpdate subscriptionsToUpdate);
Task<Departments.Department> GetDepartmentByFullIdAsync(string authToken, string boxId, string departmentId);
Expand Down
15 changes: 8 additions & 7 deletions src/Proto/OrganizationUserPermissions.cs
Expand Up @@ -13,23 +13,24 @@ public interface IOrganizationUserPermissions
bool CanAddResolutions { get; }
bool CanRequestResolutions { get; }
AuthorizationPermission AuthorizationPermission { get; }
bool CanDeleteRestoreDocuments { get; }
}

[ComVisible(true)]
[Guid("783B622C-88B1-4B88-A855-370EB9848DB0")]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof (IOrganizationUserPermissions))]
public partial class OrganizationUserPermissions: SafeComObject, IOrganizationUserPermissions
[ComDefaultInterface(typeof(IOrganizationUserPermissions))]
public partial class OrganizationUserPermissions : SafeComObject, IOrganizationUserPermissions
{
public override string ToString()
{
return string.Format("UserDepartmentId: {0}, IsAdministrator: {1}, DocumentAccessLevel: {2}, CanSignDocuments: {3}, CanAddResolutions: {4}, CanRequestResolutions: {5}",
UserDepartmentId, IsAdministrator, DocumentAccessLevel, CanSignDocuments, CanAddResolutions, CanRequestResolutions);
return string.Format("UserDepartmentId: {0}, IsAdministrator: {1}, DocumentAccessLevel: {2}, CanSignDocuments: {3}, CanAddResolutions: {4}, CanRequestResolutions: {5}, CanDeleteRestoreDocuments: {6}",
UserDepartmentId, IsAdministrator, DocumentAccessLevel, CanSignDocuments, CanAddResolutions, CanRequestResolutions, CanDeleteRestoreDocuments);
}

public Com.DocumentAccessLevel DocumentAccessLevelValue
{
get { return (Com.DocumentAccessLevel)((int)DocumentAccessLevel); }
get { return (Com.DocumentAccessLevel) ((int) DocumentAccessLevel); }
}
}

Expand All @@ -44,8 +45,8 @@ public interface IAuthorizationPermission
[ComVisible(true)]
[Guid("A66D77DE-2B5C-45FE-BD57-A755D8F803CA")]
[ClassInterface(ClassInterfaceType.None)]
[ComDefaultInterface(typeof (IAuthorizationPermission))]
[ComDefaultInterface(typeof(IAuthorizationPermission))]
public partial class AuthorizationPermission : SafeComObject, IAuthorizationPermission
{
}
}
}
7 changes: 7 additions & 0 deletions src/Proto/OrganizationUserPermissions.proto.cs
Expand Up @@ -96,6 +96,13 @@ public Diadoc.Api.Proto.AuthorizationPermission AuthorizationPermission
get { return _AuthorizationPermission; }
set { _AuthorizationPermission = value; }
}
private bool _CanDeleteRestoreDocuments;
[global::ProtoBuf.ProtoMember(13, IsRequired = true, Name=@"CanDeleteRestoreDocuments", DataFormat = global::ProtoBuf.DataFormat.Default)]
public bool CanDeleteRestoreDocuments
{
get { return _CanDeleteRestoreDocuments; }
set { _CanDeleteRestoreDocuments = value; }
}
private global::ProtoBuf.IExtension extensionObject;
global::ProtoBuf.IExtension global::ProtoBuf.IExtensible.GetExtensionObject(bool createIfMissing)
{ return global::ProtoBuf.Extensible.GetExtensionObject(ref extensionObject, createIfMissing); }
Expand Down

0 comments on commit fefe7d1

Please sign in to comment.