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)
| 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. |
| 77 | func (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. |
| 102 | func (s *Service) ProjectPermissionsForUser(ctx context.Context, projectID, userID string, orgPerms *adminv1.OrganizationPermissions) (*adminv1.ProjectPermissions, error) { |
no test coverage detected