以文本方式查看主题

-  Foxtable(狐表)  (http://foxtable.com/bbs/index.asp)
--  专家坐堂  (http://foxtable.com/bbs/list.asp?boardid=2)
----  控制编辑  (http://foxtable.com/bbs/dispbbs.asp?boardid=2&id=173896)

--  作者:nxqtxwz
--  发布时间:2021/12/21 16:40:00
--  控制编辑

请问老师,想限制编辑。就是如果班级列是1班,如果用户不是aaa就不能编辑本记录。

也就是aaa的用户只能编辑班级是1班的记录,其它人不能编辑。

         bbb的用户只能编辑班级是2班的记录,其它人不能编辑。

。。。。。。

 

班级很多,有什么简便的代码吗。

 

If "班级"="初中2019级1班" Then
    If User.Name <> "aaa" Then
        e.cancel = True
    End If
End If


--  作者:有点蓝
--  发布时间:2021/12/21 17:10:00
--  
把班级名称放到用户角色或者分组中,然后根据角色或者分组判断,比如角色

if user.isrole(e.row("班级")) = false then
e.cancel = True
endif

--  作者:nxqtxwz
--  发布时间:2021/12/22 10:20:00
--  

If user.isrole(e.Row("班级")) = False Then
e.cancel = True
End If

 

想让分组是管理员的人也能编辑,可怎么也实现不了。新增的行就是编辑不了。


--  作者:有点蓝
--  发布时间:2021/12/22 10:22:00
--  

If user.isrole(e.Row("班级")) = False andalso user.isrole("管理员") = False  Then


--  作者:nxqtxwz
--  发布时间:2021/12/22 10:35:00
--  

老师,还是不能实现。这样写就是同时是管理员和这个班的班主任才能操作了。

我是想让管理员可以操作所有的记录,班主任只能操作自己的班,怎么才能实现呢。


--  作者:有点蓝
--  发布时间:2021/12/22 10:59:00
--  
If user.isrole("管理员") = False  Then
If user.isrole(e.Row("班级")) = False Then
e.cancel = True
End If
End If