DImuthuUpe commented on code in PR #475: URL: https://github.com/apache/airavata-custos/pull/475#discussion_r3283395082
########## pkg/models/identity.go: ########## @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package models + +import "time" + +// ExternalIdentity links a User to its identifier in an external system +// (ACCESS, NAIRR, CILogon, etc.). One user may have many external identities. +// Source-specific attributes (e.g. NSF status code, ACCESS org code) belong +// in Metadata as a JSON-encoded blob. +type ExternalIdentity struct { + ID string `json:"id" db:"id"` + UserID string `json:"user_id" db:"user_id"` + Source string `json:"source" db:"source"` // e.g. access, nairr, cilogon + ExternalID string `json:"external_id" db:"external_id"` // the source's native identifier + OIDCSub string `json:"oidc_sub,omitempty" db:"oidc_sub"` // OIDC subject when the source issues one + Metadata string `json:"metadata,omitempty" db:"metadata"` // JSON-encoded source-specific fields + CreatedAt time.Time `json:"created_at" db:"created_at"` +} + +// UserDN binds an X.509 distinguished name (e.g. mTLS client cert subject) to +// a User. Append-only: DNs are credentials and are added or removed, never +// edited. Review Comment: Pls move this to AIME module as this is not required for the core ########## pkg/models/identity.go: ########## @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package models + +import "time" + +// ExternalIdentity links a User to its identifier in an external system +// (ACCESS, NAIRR, CILogon, etc.). One user may have many external identities. +// Source-specific attributes (e.g. NSF status code, ACCESS org code) belong +// in Metadata as a JSON-encoded blob. +type ExternalIdentity struct { Review Comment: +1 ########## pkg/models/project.go: ########## @@ -18,10 +38,22 @@ type Organization struct { } type User struct { - ID string `json:"id" db:"id"` - OrganizationID string `json:"organization_id" db:"organization_id"` - FirstName string `json:"first_name" db:"first_name"` - LastName string `json:"last_name" db:"last_name"` - MiddleName string `json:"middle_name,omitempty" db:"middle_name"` - Email string `json:"email" db:"email"` + ID string `json:"id" db:"id"` + OrganizationID string `json:"organization_id" db:"organization_id"` + FirstName string `json:"first_name" db:"first_name"` + LastName string `json:"last_name" db:"last_name"` + MiddleName string `json:"middle_name,omitempty" db:"middle_name"` + Email string `json:"email" db:"email"` + Status UserStatus `json:"status" db:"status"` +} + +// UserMerge is the audit record that links a retiring user to the surviving +// user that absorbed its identity-forward state. Each retiring user can be +// merged at most once; merges are not reversed in-place. +type UserMerge struct { Review Comment: Let's move it to Audit log ########## pkg/models/identity.go: ########## @@ -0,0 +1,44 @@ +// Licensed to the Apache Software Foundation (ASF) under one +// or more contributor license agreements. See the NOTICE file +// distributed with this work for additional information +// regarding copyright ownership. The ASF licenses this file +// to you under the Apache License, Version 2.0 (the +// "License"); you may not use this file except in compliance +// with the License. You may obtain a copy of the License at +// +// http://www.apache.org/licenses/LICENSE-2.0 +// +// Unless required by applicable law or agreed to in writing, +// software distributed under the License is distributed on an +// "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +// KIND, either express or implied. See the License for the +// specific language governing permissions and limitations +// under the License. + +package models + +import "time" + +// ExternalIdentity links a User to its identifier in an external system +// (ACCESS, NAIRR, CILogon, etc.). One user may have many external identities. +// Source-specific attributes (e.g. NSF status code, ACCESS org code) belong +// in Metadata as a JSON-encoded blob. +type ExternalIdentity struct { + ID string `json:"id" db:"id"` + UserID string `json:"user_id" db:"user_id"` + Source string `json:"source" db:"source"` // e.g. access, nairr, cilogon + ExternalID string `json:"external_id" db:"external_id"` // the source's native identifier + OIDCSub string `json:"oidc_sub,omitempty" db:"oidc_sub"` // OIDC subject when the source issues one + Metadata string `json:"metadata,omitempty" db:"metadata"` // JSON-encoded source-specific fields + CreatedAt time.Time `json:"created_at" db:"created_at"` Review Comment: Add userEmail ########## pkg/models/allocation.go: ########## @@ -16,10 +16,11 @@ type ComputeCluster struct { } type ComputeClusterUser struct { - ID string `json:"id" db:"id"` - ComputeClusterID string `json:"compute_cluster_id" db:"compute_cluster_id"` - UserID string `json:"user_id" db:"user_id"` - LocalUsername string `json:"local_username" db:"local_username"` // The username of the user on the compute cluster, which may be different from their Airavata Custos username. + ID string `json:"id" db:"id"` + ComputeClusterID string `json:"compute_cluster_id" db:"compute_cluster_id"` + UserID string `json:"user_id" db:"user_id"` + LocalUsername string `json:"local_username" db:"local_username"` // The username of the user on the compute cluster, which may be different from their Airavata Custos username. + Status AllocationStatus `json:"status" db:"status"` Review Comment: Better to enforce at ComputeAllocationMembership.AllocationStatus. WDYT? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected]
