Model workspace invitation policies and document ownership
This commit is contained in:
@@ -2,6 +2,7 @@ use super::contextualize::Contextualize;
|
||||
use super::{
|
||||
id::{IdError, validate_id},
|
||||
user::UserId,
|
||||
workspace::{Workspace, WorkspaceAccess, WorkspaceAccessError, WorkspaceId},
|
||||
};
|
||||
|
||||
#[derive(Clone, Debug, Eq, Hash, PartialEq)]
|
||||
@@ -42,6 +43,20 @@ pub struct OrganizationMembership {
|
||||
pub role: OrganizationRole,
|
||||
}
|
||||
|
||||
impl Organization {
|
||||
pub fn create_workspace(&self, id: WorkspaceId, name: impl Into<String>) -> Workspace {
|
||||
Workspace::owned_by(id, name, self.id.clone())
|
||||
}
|
||||
|
||||
pub fn set_workspace_access(
|
||||
&self,
|
||||
workspace: &mut Workspace,
|
||||
access: WorkspaceAccess,
|
||||
) -> Result<(), WorkspaceAccessError> {
|
||||
workspace.set_organization_access(&self.id, access)
|
||||
}
|
||||
}
|
||||
|
||||
impl Contextualize for Organization {
|
||||
fn render_context(&self) -> String {
|
||||
format!("Organization: {}", self.name)
|
||||
|
||||
Reference in New Issue
Block a user