public async Task <bool> ChangeName(int teamId, string newName) { var hasPermissions = await _userAuthorization.Authorize(_userId, teamId, TeamAction.RenameTeam); if (hasPermissions) { return(await _teamDao.ChangeName(teamId, newName)); } throw new UnauthorizedAccessException(); }
public async Task <Optional <int> > CreateMeeting(DateTime startTime, int teamId) { var currentTimeUtc = DateTime.UtcNow; if (currentTimeUtc.CompareTo(startTime) > 0) { throw new InvalidOperationException("Start time must be greater or equal current time UTC!"); } var hasPermissions = await _userAuthorization.Authorize(_userId, teamId, TeamAction.CreateMeeting); if (hasPermissions) { return(await _meetingDao.CreateMeeting(startTime.ToUniversalTime(), teamId, _userId)); } throw new UnauthorizedAccessException(); }