public static bool CanCreateItem(this AppUserRole role, Item item, string userId)
        {
            // User can't create item and assign another user to this item
            if (item.AssignedUserId == userId && role.IsDeveloper() || (item.StatusId == (int)ItemStatuses.New && item.AssignedUserId == null))
            {
                return(true);
            }

            throw new ForbiddenResponseException("You only can create item assigned by your, or new unassigned");
        }
 public static bool IsPartOfTeam(this AppUserRole role)
 {
     if (role.IsOwner() || role.IsScrumMaster() || role.IsDeveloper())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 /// <summary>
 /// Defines user roles which can view project data.
 /// </summary>
 /// <param name="projectBl">Extends project business logic class.</param>
 /// <param name="role">Role of user in project.</param>
 /// <returns>Boolean value which points to possibility to view project data.</returns>
 public static bool CanAccessProject(this ProjectBl projectBl, AppUserRole role)
 {
     if (role.IsScrumMaster() || role.IsOwner() ||
         role.IsDeveloper() || role.IsObserver())
     {
         return(true);
     }
     else
     {
         return(false);
     }
 }
 public static bool CanDeleteComment(this AppUserRole role, Comment comment, string userId)
 {
     // User can delete only comment which are written by himself
     return(role.IsScrumMasterOrOwner() || (role.IsDeveloper() && comment.UserId == userId));
 }