Returns the Workspace, true, unless the workspace has not been cached (nuked or was a prebuild).
()
| 56 | |
| 57 | // Returns the Workspace, true, unless the workspace has not been cached (nuked or was a prebuild). |
| 58 | func (cws *CachedWorkspaceFields) AsWorkspaceIdentity() (database.WorkspaceIdentity, bool) { |
| 59 | cws.lock.RLock() |
| 60 | defer cws.lock.RUnlock() |
| 61 | // Should we be more explicit about all fields being set to be valid? |
| 62 | if cws.identity.Equal(database.WorkspaceIdentity{}) { |
| 63 | return database.WorkspaceIdentity{}, false |
| 64 | } |
| 65 | return cws.identity, true |
| 66 | } |
| 67 | |
| 68 | // ContextInject attempts to inject the rbac object for the cached workspace fields |
| 69 | // into the given context, either returning the wrapped context or the original. |