web

package
v0.0.0-...-35a0bdf Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 3, 2022 License: MIT Imports: 35 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (

	// ErrAlreadyExists indicates that one or more QuickFeed repositories
	// already exists for the directory (or GitHub organization).
	ErrAlreadyExists = errors.New("course repositories already exist for that organization: " + repoNames)
	// ErrFreePlan indicates that payment plan for given organization does not allow provate
	// repositories and must be upgraded
	ErrFreePlan = errors.New("organization does not allow creation of private repositories")
	// ErrContextCanceled indicates that method failed because of scm interaction that took longer than expected
	// and not because of some application error
	ErrContextCanceled = "context canceled because the github interaction took too long. Please try again later"
	// FreeOrgPlan indicates that organization's payment plan does not allow creation of private repositories
	FreeOrgPlan = "free"
)
View Source
var ErrInvalidUserInfo = status.Errorf(codes.PermissionDenied, "authorization failed. please try to logout and sign in again")

ErrInvalidUserInfo is returned to user if user information in context is invalid.

View Source
var RepoPaths = map[string]bool{
	pb.InfoRepo:       public,
	pb.AssignmentRepo: private,
	pb.TestsRepo:      private,
}

RepoPaths maps from Autograder repository path names to a boolean indicating whether or not the repository should be create as public or private.

Functions

func Logger

func Logger(log *zap.Logger) echo.MiddlewareFunc

Logger returns a zap logger middleware.

func New

func New(ags *AutograderService, public, httpAddr string)

New starts a new web server

Types

type AutograderService

type AutograderService struct {
	pb.UnimplementedAutograderServiceServer
	// contains filtered or unexported fields
}

AutograderService holds references to the database and other shared data structures.

func NewAutograderService

func NewAutograderService(logger *zap.Logger, db database.Database, scms *auth.Scms, bh BaseHookOptions, runner ci.Runner) *AutograderService

NewAutograderService returns an AutograderService object.

func (*AutograderService) CreateBenchmark

CreateBenchmark adds a new grading benchmark for an assignment Access policy: Teacher of CourseID

func (*AutograderService) CreateCourse

func (s *AutograderService) CreateCourse(ctx context.Context, in *pb.Course) (*pb.Course, error)

CreateCourse creates a new course. Access policy: Admin.

func (*AutograderService) CreateCriterion

CreateCriterion adds a new grading criterion for an assignment Access policy: Teacher of CourseID

func (*AutograderService) CreateEnrollment

func (s *AutograderService) CreateEnrollment(_ context.Context, in *pb.Enrollment) (*pb.Void, error)

CreateEnrollment enrolls a new student for the course specified in the request. Access policy: Any User.

func (*AutograderService) CreateGroup

func (s *AutograderService) CreateGroup(ctx context.Context, in *pb.Group) (*pb.Group, error)

CreateGroup creates a new group in the database. Access policy: Any User enrolled in course and specified as member of the group or a course teacher.

func (*AutograderService) CreateReview

func (s *AutograderService) CreateReview(ctx context.Context, in *pb.ReviewRequest) (*pb.Review, error)

CreateReview adds a new submission review Access policy: Teacher of CourseID

func (*AutograderService) DeleteBenchmark

func (s *AutograderService) DeleteBenchmark(_ context.Context, in *pb.GradingBenchmark) (*pb.Void, error)

DeleteBenchmark removes a grading benchmark Access policy: Teacher of CourseID

func (*AutograderService) DeleteCriterion

func (s *AutograderService) DeleteCriterion(_ context.Context, in *pb.GradingCriterion) (*pb.Void, error)

DeleteCriterion removes a grading criterion for an assignment Access policy: Teacher of CourseID

func (*AutograderService) DeleteGroup

func (s *AutograderService) DeleteGroup(ctx context.Context, in *pb.GroupRequest) (*pb.Void, error)

DeleteGroup removes group record from the database. Access policy: Teacher of CourseID.

func (*AutograderService) GetAssignments

func (s *AutograderService) GetAssignments(_ context.Context, in *pb.CourseRequest) (*pb.Assignments, error)

GetAssignments returns a list of all assignments for the given course. Access policy: Any User.

func (*AutograderService) GetCourse

func (s *AutograderService) GetCourse(ctx context.Context, in *pb.CourseRequest) (*pb.Course, error)

GetCourse returns course information for the given course. Access policy: Any User.

func (*AutograderService) GetCourses

func (s *AutograderService) GetCourses(_ context.Context, _ *pb.Void) (*pb.Courses, error)

GetCourses returns a list of all courses. Access policy: Any User.

func (*AutograderService) GetCoursesByUser

func (s *AutograderService) GetCoursesByUser(_ context.Context, in *pb.EnrollmentStatusRequest) (*pb.Courses, error)

GetCoursesByUser returns all courses the given user is enrolled into with the given status. Access policy: Any User.

func (*AutograderService) GetEnrollmentsByCourse

func (s *AutograderService) GetEnrollmentsByCourse(ctx context.Context, in *pb.EnrollmentRequest) (*pb.Enrollments, error)

GetEnrollmentsByCourse returns all enrollments for the course specified in the request. Access policy: Teacher or student of CourseID.

func (*AutograderService) GetEnrollmentsByUser

func (s *AutograderService) GetEnrollmentsByUser(ctx context.Context, in *pb.EnrollmentStatusRequest) (*pb.Enrollments, error)

GetEnrollmentsByUser returns all enrollments for the given user and enrollment status with preloaded courses and groups. Access policy: user with userID or admin

func (*AutograderService) GetGroup

func (s *AutograderService) GetGroup(ctx context.Context, in *pb.GetGroupRequest) (*pb.Group, error)

GetGroup returns information about a group. Access policy: Group members, Teacher of CourseID.

func (*AutograderService) GetGroupByUserAndCourse

func (s *AutograderService) GetGroupByUserAndCourse(ctx context.Context, in *pb.GroupRequest) (*pb.Group, error)

GetGroupByUserAndCourse returns the group of the given student for a given course. Access policy: Group members, Teacher of CourseID.

func (*AutograderService) GetGroupsByCourse

func (s *AutograderService) GetGroupsByCourse(ctx context.Context, in *pb.CourseRequest) (*pb.Groups, error)

GetGroupsByCourse returns a list of groups created for the course id in the record request. Access policy: Teacher of CourseID.

func (*AutograderService) GetOrganization

func (s *AutograderService) GetOrganization(ctx context.Context, in *pb.OrgRequest) (*pb.Organization, error)

GetOrganization fetches a github organization by name. Access policy: Admin

func (*AutograderService) GetProviders

func (s *AutograderService) GetProviders(_ context.Context, _ *pb.Void) (*pb.Providers, error)

GetProviders returns a list of SCM providers supported by the backend. Access policy: Any User.

func (*AutograderService) GetRepositories

func (s *AutograderService) GetRepositories(ctx context.Context, in *pb.URLRequest) (*pb.Repositories, error)

GetRepositories returns URL strings for repositories of given type for the given course Access policy: Any User.

func (*AutograderService) GetReviewers

GetReviewers returns names of all active reviewers for a student submission Access policy: Teacher of CourseID

func (*AutograderService) GetSubmissions

func (s *AutograderService) GetSubmissions(ctx context.Context, in *pb.SubmissionRequest) (*pb.Submissions, error)

GetSubmissions returns the submissions matching the query encoded in the action request. Access policy: Admin enrolled in CourseID, Current User if Owner of submission, Current User if member of group for group submission, Teacher of CourseID.

func (*AutograderService) GetSubmissionsByCourse

func (s *AutograderService) GetSubmissionsByCourse(ctx context.Context, in *pb.SubmissionsForCourseRequest) (*pb.CourseSubmissions, error)

GetSubmissionsByCourse returns all the latest submissions for every individual or group course assignment for all course students/groups. Access policy: Admin enrolled in CourseID, Teacher of CourseID.

func (*AutograderService) GetUser

func (s *AutograderService) GetUser(ctx context.Context, _ *pb.Void) (*pb.User, error)

GetUser will return current user with active course enrollments to use in separating teacher and admin roles Access policy: everyone

func (*AutograderService) GetUserByCourse

func (s *AutograderService) GetUserByCourse(ctx context.Context, in *pb.CourseUserRequest) (*pb.User, error)

GetUserByCourse returns the user matching the given course name and GitHub login specified in CourseUserRequest. Access policy: Admins or course teachers

func (*AutograderService) GetUsers

func (s *AutograderService) GetUsers(ctx context.Context, _ *pb.Void) (*pb.Users, error)

GetUsers returns a list of all users. Access policy: Admin. Frontend note: This method is called from AdminPage.

func (*AutograderService) IsAuthorizedTeacher

func (s *AutograderService) IsAuthorizedTeacher(ctx context.Context, _ *pb.Void) (*pb.AuthorizationResponse, error)

IsAuthorizedTeacher checks whether current user has teacher scopes. Access policy: Any User.

func (*AutograderService) IsEmptyRepo

func (s *AutograderService) IsEmptyRepo(ctx context.Context, in *pb.RepositoryRequest) (*pb.Void, error)

IsEmptyRepo ensures that group repository is empty and can be deleted Access policy: Teacher of Course ID

func (*AutograderService) RebuildSubmissions

func (s *AutograderService) RebuildSubmissions(ctx context.Context, in *pb.RebuildRequest) (*pb.Void, error)

RebuildSubmissions re-runs the tests for the given assignment. A single submission is executed again if the request specifies a submission ID or all submissions if the request specifies a course ID. Access policy: Teacher of CourseID.

func (*AutograderService) UpdateAssignments

func (s *AutograderService) UpdateAssignments(ctx context.Context, in *pb.CourseRequest) (*pb.Void, error)

UpdateAssignments updates the assignments record in the database by fetching assignment information from the course's test repository. Access policy: Teacher of CourseID.

func (*AutograderService) UpdateBenchmark

func (s *AutograderService) UpdateBenchmark(_ context.Context, in *pb.GradingBenchmark) (*pb.Void, error)

UpdateBenchmark edits a grading benchmark for an assignment Access policy: Teacher of CourseID

func (*AutograderService) UpdateCourse

func (s *AutograderService) UpdateCourse(ctx context.Context, in *pb.Course) (*pb.Void, error)

UpdateCourse changes the course information details. Access policy: Teacher of CourseID.

func (*AutograderService) UpdateCourseVisibility

func (s *AutograderService) UpdateCourseVisibility(ctx context.Context, in *pb.Enrollment) (*pb.Void, error)

UpdateCourseVisibility allows to edit what courses are visible in the sidebar. Access policy: Any User.

func (*AutograderService) UpdateCriterion

func (s *AutograderService) UpdateCriterion(_ context.Context, in *pb.GradingCriterion) (*pb.Void, error)

UpdateCriterion edits a grading criterion for an assignment Access policy: Teacher of CourseID

func (*AutograderService) UpdateEnrollments

func (s *AutograderService) UpdateEnrollments(ctx context.Context, in *pb.Enrollments) (*pb.Void, error)

UpdateEnrollments changes status of all pending enrollments for the specified course to approved. If the request contains a single enrollment, it will be updated to the specified status. Access policy: Teacher of CourseID

func (*AutograderService) UpdateGroup

func (s *AutograderService) UpdateGroup(ctx context.Context, in *pb.Group) (*pb.Group, error)

UpdateGroup updates group information, and returns the updated group. Access policy: Teacher of CourseID.

func (*AutograderService) UpdateReview

func (s *AutograderService) UpdateReview(ctx context.Context, in *pb.ReviewRequest) (*pb.Review, error)

UpdateReview updates a submission review Access policy: Teacher of CourseID, Author of the given Review

func (*AutograderService) UpdateSubmission

func (s *AutograderService) UpdateSubmission(ctx context.Context, in *pb.UpdateSubmissionRequest) (*pb.Void, error)

UpdateSubmission is called to approve the given submission or to undo approval. Access policy: Teacher of CourseID.

func (*AutograderService) UpdateSubmissions

func (s *AutograderService) UpdateSubmissions(ctx context.Context, in *pb.UpdateSubmissionsRequest) (*pb.Void, error)

UpdateSubmissions approves and/or releases all manual reviews for student submission for the given assignment with the given score. Access policy: Creator of CourseID

func (*AutograderService) UpdateUser

func (s *AutograderService) UpdateUser(ctx context.Context, in *pb.User) (*pb.Void, error)

UpdateUser updates the current users's information and returns the updated user. This function can also promote a user to admin or demote a user. Access policy: Admin can update other users's information and promote to Admin; Current User if Owner can update its own information.

type BaseHookOptions

type BaseHookOptions struct {
	BaseURL string
	Secret  string
}

BaseHookOptions store the application's callback url and secret

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL