/* Group accesses */ public async Task <GroupAccess> GrantAccess(int groupId, string userId, GroupAccessType accessType, string grantedById) { var currentAccess = db.GroupAccesses.FirstOrDefault(a => a.GroupId == groupId && a.UserId == userId); if (currentAccess == null) { currentAccess = new GroupAccess { GroupId = groupId, UserId = userId, }; db.GroupAccesses.Add(currentAccess); } currentAccess.AccessType = accessType; currentAccess.GrantedById = grantedById; currentAccess.GrantTime = DateTime.Now; currentAccess.IsEnabled = true; await db.SaveChangesAsync(); return(db.GroupAccesses.Include(a => a.GrantedBy).Single(a => a.Id == currentAccess.Id)); }
/// <summary> /// <para>Begins an asynchronous send to the groups members set access type /// route.</para> /// </summary> /// <param name="group">Specify a group.</param> /// <param name="user">Identity of a user that is a member of <paramref name="@group" /// />.</param> /// <param name="accessType">New group access type the user will have.</param> /// <param name="callback">The method to be called when the asynchronous send is /// completed.</param> /// <param name="callbackState">A user provided object that distinguished this send /// from other send requests.</param> /// <returns>An object that represents the asynchronous send request.</returns> public sys.IAsyncResult BeginGroupsMembersSetAccessType(GroupSelector @group, UserSelectorArg user, GroupAccessType accessType, sys.AsyncCallback callback, object callbackState = null) { var groupMembersSetAccessTypeArg = new GroupMembersSetAccessTypeArg(@group, user, accessType); return this.BeginGroupsMembersSetAccessType(groupMembersSetAccessTypeArg, callback, callbackState); }
/// <summary> /// <para>Sets a member's access type in a group.</para> /// <para>Permission : Team member management</para> /// </summary> /// <param name="group">Specify a group.</param> /// <param name="user">Identity of a user that is a member of <paramref name="@group" /// />.</param> /// <param name="accessType">New group access type the user will have.</param> /// <returns>The task that represents the asynchronous send operation. The TResult /// parameter contains the response from the server.</returns> /// <exception cref="Dropbox.Api.ApiException{GroupMemberSelectorError}">Thrown if /// there is an error processing the request; This will contain a <see /// cref="GroupMemberSelectorError"/>.</exception> public t.Task<col.List<GroupsGetInfoItem>> GroupsMembersSetAccessTypeAsync(GroupSelector @group, UserSelectorArg user, GroupAccessType accessType) { var groupMembersSetAccessTypeArg = new GroupMembersSetAccessTypeArg(@group, user, accessType); return this.GroupsMembersSetAccessTypeAsync(groupMembersSetAccessTypeArg); }