如何防止人们在 Perforce 中编辑其他人的工作区选项?

发布于 2024-08-07 15:22:46 字数 107 浏览 12 评论 0原文

我是 Perforce 的新手。我们当前的服务器似乎存在配置错误,因为任何人都可以更改其他人的工作区选项。

有谁知道如何快速解决该问题?

谢谢,

托马斯

I am new to Perforce. There seems to be a a misconfiguration in our current Server, as anybody can change anyone else's workspace options.

Does anyone know how to quickly fix that problem ?

Thanks,

Thomas

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(4

撩人痒 2024-08-14 15:22:46

如果您在工作区中设置“锁定”选项,则工作区只能由其所有者(或具有“管理员”或更高访问级别的用户)修改。它还会阻止其他用户使用或删除该工作区。

If you set the 'locked' option in the workspace, then the workspace can only be modified by its owner (or by a user with 'admin' or higher access level). It'll also prevent other users from using or deleting that workspace.

护你周全 2024-08-14 15:22:46

我不知道有什么方法可以轻松或快速地解决该问题。

话说回来,能力真的有问题吗?或者是不同的人认为他们拥有不同的工作空间配置?在我工作的地方,我们将用户名添加到我们想要维护为自己的工作区的前缀,并将其保留在共享工作区之外(或有时使用不同的前缀)。

如果工作空间的所有权不明确并导致问题,这将解决您的问题。如果同事忽视所有权并故意做出改变,您可能还有其他问题需要担心。

I don't know of a way to easily or quickly fix the problem.

Having said that, is the ability being there really a problem? Or is it that different people think they have ownership of different workspace configurations? Here where I work, we prefix the username to any workspace that we want to maintain as our own, and leave it off of shared workspaces (or use a different prefix, at times).

If it is a situation where the ownership of a workspace is unclear and that is causing issues, this would resolve your problems. If it is a situation where coworkers are ignoring the ownership and intentionally making changes, you likely have other problems to worry about.

巨坚强 2024-08-14 15:22:46

不是直接修复,但您可以通过实施“Spec Depot”来跟踪对客户端规格所做的更改。请参阅此处的知识库文章

我必须承认,在阅读您的问题之前,我什至没有意识到您可以在没有管理员权限的情况下修改其他用户的客户端规范。在使用 Perforce 的 9 年里,我从未遇到过这对人们来说是一个实际问题。

cjhuitt 建议在客户端规范中添加用户名/首字母缩写,这是一个很好的建议,并且是很常见的做法,特别是在大型安装中。

Not a direct fix, but you can track changes made to client specs by implementing a "Spec Depot". See KB article here.

I must admit prior to reading your question I did not even realise you could modify another user's client spec without admin rights. In the 9 years of using Perforce I have never come across that as being an actual problem for people.

cjhuitt's suggestion of prefixing a client spec with user name/initials is a good one, and is pretty common practice, particularly in larger installations.

沩ん囻菔务 2024-08-14 15:22:46

锁定工作空间是正确的方法,谢谢 Heath。

我编写了一个小型 PERL 脚本来锁定所有现有工作区:

#*******************************************************************************
# Module:   LockClients.pl
# Purpose:  A perl script using the CLI to lock all clients on a server
# 

# Debug Flag:
$DEBUG_FLAG = 1 ; # 1 for TRUE, 0 for FALSE

# Get the list of clients on the server:
@list = `p4 clients`;

foreach $client (@list) {
    # Get client name:
    $clientname = (split / /,$client)[1];
    if ( $DEBUG_FLAG ) { print ("Client name: $clientname \n"); }
    # Prepare temporary file name (will contain the new config spec of the client):
    $filename = sprintf("tmp_%s.txt",$clientname);
    if ( $DEBUG_FLAG ) { print ("Temporary file: $filename \n"); }
    # Get client spec:
    @clientspec = `p4 client -o $clientname`;
    # Write client spec to file:
    open (VIRTUAL , ">$filename" ) || die "ERROR: Could not create $filename \n";
    foreach $line (@clientspec) {
        if ($line =~ m/^Options:.*$/m){
            if ( $DEBUG_FLAG ) { print ("Line before substitution: $line"); }
            $line =~ s/unlocked/locked/;
            if ( $DEBUG_FLAG ) { print ("Line after substitution: $line"); }
        }
    print VIRTUAL $line;
    }
    close (VIRTUAL);
    # Import new config spec in client:
    `p4 client -i -f < $filename`;
    if ( $DEBUG_FLAG ) { print ("Workspace $clientname locked !\n\n"); }
}       
exit 0;

我现在将尝试在创建或编辑工作区后使用触发器强制执行锁定选项。 :)

托马斯

Locking the workspace is the way to go, thanks Heath.

I have worked on a small PERL script to lock all existing workspaces:

#*******************************************************************************
# Module:   LockClients.pl
# Purpose:  A perl script using the CLI to lock all clients on a server
# 

# Debug Flag:
$DEBUG_FLAG = 1 ; # 1 for TRUE, 0 for FALSE

# Get the list of clients on the server:
@list = `p4 clients`;

foreach $client (@list) {
    # Get client name:
    $clientname = (split / /,$client)[1];
    if ( $DEBUG_FLAG ) { print ("Client name: $clientname \n"); }
    # Prepare temporary file name (will contain the new config spec of the client):
    $filename = sprintf("tmp_%s.txt",$clientname);
    if ( $DEBUG_FLAG ) { print ("Temporary file: $filename \n"); }
    # Get client spec:
    @clientspec = `p4 client -o $clientname`;
    # Write client spec to file:
    open (VIRTUAL , ">$filename" ) || die "ERROR: Could not create $filename \n";
    foreach $line (@clientspec) {
        if ($line =~ m/^Options:.*$/m){
            if ( $DEBUG_FLAG ) { print ("Line before substitution: $line"); }
            $line =~ s/unlocked/locked/;
            if ( $DEBUG_FLAG ) { print ("Line after substitution: $line"); }
        }
    print VIRTUAL $line;
    }
    close (VIRTUAL);
    # Import new config spec in client:
    `p4 client -i -f < $filename`;
    if ( $DEBUG_FLAG ) { print ("Workspace $clientname locked !\n\n"); }
}       
exit 0;

I will now work to try to enforce the lock option with a trigger after a workspace is created or edited. :)

Thomas

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文