MCPcopy Index your code
hub / github.com/rilldata/rill / OrganizationPermissionsForMagicAuthToken

Method OrganizationPermissionsForMagicAuthToken

admin/permissions.go:77–99  ·  view source on GitHub ↗

OrganizationPermissionsForMagicAuthToken resolves organization permissions for a magic auth token in the specified project. It grants basic read access to only the org of the project the token belongs to.

(ctx context.Context, orgID, tokenProjectID string)

Source from the content-addressed store, hash-verified

75// OrganizationPermissionsForMagicAuthToken resolves organization permissions for a magic auth token in the specified project.
76// It grants basic read access to only the org of the project the token belongs to.
77func (s *Service) OrganizationPermissionsForMagicAuthToken(ctx context.Context, orgID, tokenProjectID string) (*adminv1.OrganizationPermissions, error) {
78 proj, err := s.DB.FindProject(ctx, tokenProjectID)
79 if err != nil {
80 return nil, err
81 }
82
83 if orgID == proj.OrganizationID {
84 return &adminv1.OrganizationPermissions{
85 Admin: false,
86 Guest: true,
87 ReadOrg: true,
88 ManageOrg: false,
89 ReadProjects: false,
90 CreateProjects: false,
91 ManageProjects: false,
92 ReadOrgMembers: false,
93 ManageOrgMembers: false,
94 ManageOrgAdmins: false,
95 }, nil
96 }
97
98 return &adminv1.OrganizationPermissions{}, nil
99}
100
101// ProjectPermissionsForUser resolves project permissions for a user.
102func (s *Service) ProjectPermissionsForUser(ctx context.Context, projectID, userID string, orgPerms *adminv1.OrganizationPermissions) (*adminv1.ProjectPermissions, error) {

Callers 1

Calls 1

FindProjectMethod · 0.65

Tested by

no test coverage detected