Commit 9cd2c8cf authored by Daniele Venzano's avatar Daniele Venzano
Browse files

Creating and destroying workspace directories would require root privileges for Zoe

Let the administrator do that, together with user management
parent 398251a0
......@@ -13,20 +13,11 @@
# See the License for the specific language governing permissions and
# limitations under the License.
import zoe_master.state.user
class ZoeWorkspaceBase:
def create(self, user: zoe_master.state.user.User):
raise NotImplementedError
def destroy(self, user: zoe_master.state.user.User):
raise NotImplementedError
def get_path(self, user: zoe_master.state.user.User) -> str:
def get_path(self, user_id) -> str:
raise NotImplementedError
def exists(self, user: zoe_master.state.user.User) -> bool:
def exists(self, user_id) -> bool:
raise NotImplementedError
def can_be_attached(self) -> bool:
......
......@@ -14,7 +14,6 @@
# limitations under the License.
import os.path
import shutil
import logging
import zoe_master.workspace.base
......@@ -27,22 +26,11 @@ class ZoeFSWorkspace(zoe_master.workspace.base.ZoeWorkspaceBase):
def __init__(self):
self.base_path = os.path.join(config.get_conf().workspace_base_path, config.get_conf().deployment_name)
def create(self, user):
path = os.path.join(self.base_path, user.name)
os.makedirs(path, exist_ok=True)
def exists(self, user_id):
return os.path.exists(os.path.join(self.base_path, user_id))
def destroy(self, user):
path = os.path.join(self.base_path, user.name)
try:
shutil.rmtree(path)
except OSError:
log.warning("Cannot remove workspace directory %s" % path)
def exists(self, user):
return os.path.exists(os.path.join(self.base_path, user.name))
def get_path(self, user):
return os.path.join(self.base_path, user.name)
def get_path(self, user_id):
return os.path.join(self.base_path, user_id)
def can_be_attached(self):
return True
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment