mirror of
https://github.com/kuaifan/dootask.git
synced 2025-12-12 19:35:50 +00:00
perf: 共享文件删除、移动改为仅限所有者或创建者操作
This commit is contained in:
parent
22e718423e
commit
3b38c8b408
@ -53,12 +53,12 @@ class File extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* 是否有访问权限
|
* 是否有访问权限
|
||||||
* @param $userid
|
* @param $userid
|
||||||
* @return int -1:没有权限,0:访问权限,1:读写权限,1000:所有者
|
* @return int -1:没有权限,0:访问权限,1:读写权限,1000:所有者或创建者
|
||||||
*/
|
*/
|
||||||
public function getPermission($userid)
|
public function getPermission($userid)
|
||||||
{
|
{
|
||||||
if ($userid == $this->userid) {
|
if ($userid == $this->userid || $userid == $this->created_id) {
|
||||||
// ① 自己的文件夹
|
// ① 自己的文件夹 或 自己创建的文件夹
|
||||||
return 1000;
|
return 1000;
|
||||||
}
|
}
|
||||||
$row = $this->getShareInfo();
|
$row = $this->getShareInfo();
|
||||||
@ -217,7 +217,7 @@ class File extends AbstractModel
|
|||||||
/**
|
/**
|
||||||
* 获取文件并检测权限
|
* 获取文件并检测权限
|
||||||
* @param $id
|
* @param $id
|
||||||
* @param int $limit 要求权限: 0-访问权限、1-读写权限、1000-所有者
|
* @param int $limit 要求权限: 0-访问权限、1-读写权限、1000-所有者或创建者
|
||||||
* @param $permission
|
* @param $permission
|
||||||
* @return File
|
* @return File
|
||||||
*/
|
*/
|
||||||
@ -231,7 +231,7 @@ class File extends AbstractModel
|
|||||||
$permission = $file->getPermission(User::userid());
|
$permission = $file->getPermission(User::userid());
|
||||||
if ($permission < $limit) {
|
if ($permission < $limit) {
|
||||||
$msg = match ($limit) {
|
$msg = match ($limit) {
|
||||||
1000 => '仅限所有者操作',
|
1000 => '仅限所有者或创建者操作',
|
||||||
1 => '没有读写权限',
|
1 => '没有读写权限',
|
||||||
default => '没有访问权限',
|
default => '没有访问权限',
|
||||||
};
|
};
|
||||||
|
|||||||
@ -80,6 +80,12 @@
|
|||||||
<i class="taskfont"></i>
|
<i class="taskfont"></i>
|
||||||
</div>
|
</div>
|
||||||
</template>
|
</template>
|
||||||
|
<template v-else-if="isParentShare">
|
||||||
|
<UserAvatar :userid="item.created_id" class="share-avatar" :size="20">
|
||||||
|
<p v-if="item.created_id != item.userid"><strong>{{$L('成员创建于')}}: {{item.created_at}}</strong></p>
|
||||||
|
<p v-else>{{$L('所有者创建于')}}: {{item.created_at}}</p>
|
||||||
|
</UserAvatar>
|
||||||
|
</template>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="item._edit" class="file-input">
|
<div v-if="item._edit" class="file-input">
|
||||||
<Input
|
<Input
|
||||||
@ -487,7 +493,12 @@ export default {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return array;
|
return array;
|
||||||
}
|
},
|
||||||
|
|
||||||
|
isParentShare() {
|
||||||
|
const {navigator} = this;
|
||||||
|
return !!navigator.find(({share}) => share);
|
||||||
|
},
|
||||||
},
|
},
|
||||||
|
|
||||||
watch: {
|
watch: {
|
||||||
@ -620,6 +631,15 @@ export default {
|
|||||||
},
|
},
|
||||||
}))
|
}))
|
||||||
}
|
}
|
||||||
|
} else if (this.isParentShare) {
|
||||||
|
iconArray.push(h('UserAvatar', {
|
||||||
|
props: {
|
||||||
|
userid: row.created_id,
|
||||||
|
size: 20
|
||||||
|
},
|
||||||
|
}, [
|
||||||
|
row.created_id != row.userid ? h('p', [h('strong', this.$L('成员创建于') + ": " + row.created_at)]) : h('p', this.$L('所有者创建') + ": " + row.created_at)
|
||||||
|
]))
|
||||||
}
|
}
|
||||||
return h('div', {
|
return h('div', {
|
||||||
class: 'file-nbox'
|
class: 'file-nbox'
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user