You are viewing a plain text version of this content. The canonical link for it is here.
Posted to devnull@infra.apache.org by "chadgilloth (GitHub)" <gi...@apache.org> on 2018/08/21 20:11:22 UTC

[GitHub] [trafficcontrol] chadgilloth opened issue #2732: Unable to Edit or Delete a Tenant where Active is false

When a Tenant is made inactive, the user loses the ability to edit or delete it from the system. An error is returned to the user: "not authorized on this tenant." This limitation should be removed.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] ocket8888 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "ocket8888 (GitHub)" <gi...@apache.org>.
So, after testing I've found that one cannot add a user to an inactive tenant - as expected, actually - but a tenant that is created, user added, then disabled can actually modify properties of its child tenants and (presumably) the child's Delivery Services and such.
Contrary to what you would think, @rawlinp, the child tenant can still modify itself, and therefore (presumably) any of its own Delivery Services and such.

> If Sam has tenant=root, he should definitely be able to update the foo tenant to set active=true
I would expect that the root tenant cannot be disabled, and should therefore always be able to update any tenant or resource.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] dangogh closed issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "dangogh (GitHub)" <gi...@apache.org>.
[ issue closed by dangogh ]

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] ocket8888 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "ocket8888 (GitHub)" <gi...@apache.org>.
So, after testing I've found that one cannot add a user to an inactive tenant - as expected, actually - but a tenant that is created, user added, then disabled can actually modify properties of its child tenants and (presumably) the child's Delivery Services and such.
Contrary to what you would think, @rawlinp, the child tenant can still modify itself, and therefore (presumably) any of its own Delivery Services and such.

> If Sam has tenant=root, he should definitely be able to update the foo tenant to set active=true

I would expect that the root tenant cannot be disabled, and should therefore always be able to update any tenant or resource.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
I think this is a bug but honestly, I'm not sure what the expected behavior is with the active flag on a tenant.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
well there's definitely a bug. back to the tenant tree:

```
- root (active)
-- foo (inactive)
```

If Sam has tenant=root, he should definitely be able to update the `foo` tenant to set active=true


[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] ocket8888 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "ocket8888 (GitHub)" <gi...@apache.org>.
Tenancy should apply to the permissions allowed to a user, not to the objects owned by a certain tenant. If the goal is for everything to respect tenancy at some point in the future, I see no reason why a user belonging to a disabled tenant should be able to log in at all.
An inactive tenant and all of its descendants should all be considered disabled, with no ability to affect anything requiring tenant permissions. This is "easily" implemented as a hook in a modification of a tenant. When changing its activity status to `false`, disable all children as well. When (re-)enabling a disabled tenant, do **not** cascade the changes, as any disabled states down the ancestry tree have been lost. When changing a tenant's parent or activity status (or adding a new tenant), refuse requests that activate it while it has a disabled parent. If a new tenant is added without specifying activity, its state should default to enabled unless it has a disabled ancestor.
An active tenant should be able to modify any resource belonging to itself or its children - regardless of the state of the children to whom the resource may belong.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
^^ that was a lot to digest @ocket8888 :)

I definitely agree with this part: "a user belonging to a disabled tenant [or a tenant that is the descendant of a disabled tenant] should [NOT] be able to log in at all"

now how the cascading happens when tenants are activated/deactivated, i'm not entirely sure.

you want to take this to the email list?



[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] nir-sopher commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "nir-sopher (GitHub)" <gi...@apache.org>.
Hi,
This is not the expected behavior, unless the active user that tires to delete the subject user, is on the same (now inactive) tenant.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] rob05c commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "rob05c (GitHub)" <gi...@apache.org>.
I'm hitting this issue, trying to fix the TO API Tests for tenancy.

>I've dug a bit into this issue, and I believe the issue is in IsResourceAuthorizedToUserTx, >specifically line 197 in tenancy.go. The expected behavior is that an active tenant that is the parent >of any inactive tenant should still be able to modify that tenant.
>I'd suggest that the active in this case refer to the activity of the requesting user's tenant, not the >activity of the tenant being modified.

I think I agree. I think the solution is to fix the query in `IsResourceAuthorizedToUserTx` to return true if the user's tenant is active, and is a parent of the resource's tenant, irrespective whether the resource's direct tenant is active.

I also agree with the discussion on the mailing list, that there are bigger issues with how tenancy and activity is treated. But I think it's worth fixing the immediate bug, if it isn't too difficult, even before we figure out the larger solution.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
I think this is a bug but honestly, I'm not sure what the expected behavior is with the active flag on a tenant. @nir-sopher may know.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] ocket8888 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "ocket8888 (GitHub)" <gi...@apache.org>.
I've dug a bit into this issue, and I believe the issue is in `IsResourceAuthorizedToUserTx`, specifically [line 197 in tenancy.go](https://github.com/apache/trafficcontrol/blob/master/traffic_ops/traffic_ops_golang/tenant/tenancy.go#L197). The expected behavior is that an active tenant that is the parent of any inactive tenant should still be able to modify that tenant.
I'd suggest that the `active` in this case refer to the activity of the requesting _user's_ tenant, not the activity of the tenant being modified.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
@nir-sopher assuming the tenant tree looks like this:

```
- root (active)
-- foo (inactive)
--- bar (active)
```

If the jeremy user belongs to the foo (inactive) tenant, what does that mean? That jeremy can't do anything tenant-related?

what if the jeremy user belongs to the bar (active) tenant, what does that mean? That jeremy can't do anything tenant-related because i'm part of an "inactive" tenant branch?

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
^^ that was a lot to digest @ocket8888 :)

I definitely agree with this part: "a user belonging to a disabled tenant [or a tenant that is the descendant of a disabled tenant] should [NOT] be able to log in at all"

now how the cascading happens when tenants are activated/deactivated, i'm not entirely sure.

so, actually maybe this makes sense:

user.tenant.active == false (or user.tenant's ancestor.active == false) means user can't log in
ds.tenant.active == false (or ds.tenant's ancestor.active == false) means ds is not included in snapshot. basically the same as ds.active == false???

you want to take this to the email list?



[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
@nir-sopher assuming the tenant tree looks like this:

```
- root (active)
-- foo (inactive)
--- bar (active)
```

If the jeremy user belongs to the foo (inactive) tenant, what does that mean? That jeremy can't do anything tenant-related?

what if the jeremy user belongs to the bar (active) tenant, what does that mean? That jeremy can't do anything tenant-related because he's part of an "inactive" tenant branch?

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] rawlinp commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "rawlinp (GitHub)" <gi...@apache.org>.
I'd think if you set a parent tenant to inactive that all that parent's children would also effectively be inactive as well. I could see that as a means of effectively disabling entire branches of tenants for whatever reason, rather than having to go through and disable each and every child in that branch.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] ocket8888 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "ocket8888 (GitHub)" <gi...@apache.org>.
I believe users in `bar` will be safe, but users strictly in `foo` are well and truly boned. I don't even think they - or an administrator - can change their tenancy. Not sure without testing

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] mitchell852 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "mitchell852 (GitHub)" <gi...@apache.org>.
@nir-sopher assuming the tenant tree looks like this:

```
- root (active)
-- foo (inactive)
--- bar (active)
```

If the jeremy user belongs to the foo (inactive) tenant, what does that mean? That I can't do anything tenant-related?

what if the jeremy user belongs to the bar (active) tenant, what does that mean? That I can't do anything tenant-related because i'm part of an "inactive" tenant branch?

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] rob05c commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "rob05c (GitHub)" <gi...@apache.org>.
I'm hitting this issue, trying to fix the TO API Tests for tenancy.

>I've dug a bit into this issue, and I believe the issue is in IsResourceAuthorizedToUserTx, specifically line 197 in tenancy.go. The expected behavior is that an active tenant that is the parent of any inactive tenant should still be able to modify that tenant. I'd suggest that the active in this case refer to the activity of the requesting user's tenant, not the activity of the tenant being modified.

I think I agree. I think the solution is to fix the query in `IsResourceAuthorizedToUserTx` to return true if the user's tenant is active, and is a parent of the resource's tenant, irrespective whether the resource's direct tenant is active.

I also agree with the discussion on the mailing list, that there are bigger issues with how tenancy and activity is treated. But I think it's worth fixing the immediate bug, if it isn't too difficult, even before we figure out the larger solution.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org

[GitHub] [trafficcontrol] ocket8888 commented on issue #2732: Unable to Edit or Delete a Tenant where Active is false

Posted by "ocket8888 (GitHub)" <gi...@apache.org>.
Actually, further testing reveals that those "(presumably)"s don't need to be there. A disabled tenant can still modify its child resources, and the child of a disabled tenant can modify its own resources and (presumably) the resources of any of its descendants.

[ Full content available at: https://github.com/apache/trafficcontrol/issues/2732 ]
This message was relayed via gitbox.apache.org for devnull@infra.apache.org