lahirujayathilake commented on code in PR #581:
URL: https://github.com/apache/airavata-custos/pull/581#discussion_r4171955697


##########
connectors/COmanage/Identity-Provisioner/internal/operations/orchestrator_test.go:
##########
@@ -323,3 +323,10 @@ func 
TestEnsurePOSIXAccount_SkipsAnAccountThatIsNotApproved(t *testing.T) {
                t.Errorf("pending account was marked provisioned: %v", 
core.markedProvisioned)
        }
 }
+
+func TestStorePersonID_RepointsAStaleID(t *testing.T) {

Review Comment:
   use general names for test cases



##########
pkg/service/compute_allocation.go:
##########
@@ -86,6 +87,13 @@ func (s *Service) CreateComputeAllocation(ctx 
context.Context, alloc *models.Com
                return nil, fmt.Errorf("%w: compute cluster %q not found", 
ErrInvalidInput, alloc.ComputeClusterID)
        }
 
+       name := posix.Normalize(alloc.Name)
+       if name == "" {
+               return nil, fmt.Errorf("%w: allocation name %q has no letters 
or digits", ErrInvalidInput, alloc.Name)
+       }
+       group := "proj-" + name[:min(len(name), posix.MaxLoginLen-len("proj-"))]

Review Comment:
   better to avoid collisions here. If the generated group name already exists 
on the cluster. (because of the 'allocation name')



##########
connectors/COmanage/Identity-Provisioner/internal/operations/ensure_allocation_group.go:
##########
@@ -0,0 +1,99 @@
+// 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 operations
+
+import (
+       "context"
+       "strconv"
+
+       "github.com/apache/airavata-custos/pkg/models"
+)
+
+// allocationGIDBase offsets a CoGroup id into a gid above the personal
+// groups, which mirror uidnumbers.
+const allocationGIDBase = 3_000_000
+
+// EnsureAllocationGroup gives an active allocation its CoGroup and makes it
+// hold exactly the allocation's group members.
+func (o *Orchestrator) EnsureAllocationGroup(ctx context.Context, a 
*models.ComputeAllocation) error {

Review Comment:
   add audit events for group created, member added, member removed and group 
deleted. 



-- 
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]

Reply via email to