CheckTarget confirms that the user is logged in. Optionally it will also check if an organization and space are targeted.
(targetedOrganizationRequired bool, targetedSpaceRequired bool)
| 5 | // CheckTarget confirms that the user is logged in. Optionally it will also |
| 6 | // check if an organization and space are targeted. |
| 7 | func (actor Actor) CheckTarget(targetedOrganizationRequired bool, targetedSpaceRequired bool) error { |
| 8 | if !actor.IsLoggedIn() { |
| 9 | return actionerror.NotLoggedInError{ |
| 10 | BinaryName: actor.Config.BinaryName(), |
| 11 | } |
| 12 | } |
| 13 | |
| 14 | if targetedOrganizationRequired { |
| 15 | if !actor.IsOrgTargeted() { |
| 16 | return actionerror.NoOrganizationTargetedError{ |
| 17 | BinaryName: actor.Config.BinaryName(), |
| 18 | } |
| 19 | } |
| 20 | |
| 21 | if targetedSpaceRequired { |
| 22 | if !actor.IsSpaceTargeted() { |
| 23 | return actionerror.NoSpaceTargetedError{ |
| 24 | BinaryName: actor.Config.BinaryName(), |
| 25 | } |
| 26 | } |
| 27 | } |
| 28 | } |
| 29 | |
| 30 | return nil |
| 31 | } |
| 32 | |
| 33 | func (actor Actor) RequireCurrentUser() (string, error) { |
| 34 | if !actor.IsLoggedIn() { |
nothing calls this directly
no test coverage detected