Perforce making read only - perforce

I need to make the repositories inside a depot as read-only, so that no one should check in any files.
Could any one assist on the same or provide some commands to make a specific repo read only.
Any help would be appreciated.
Let me know, if any information is needed, Thanks.

Run p4 protect. Change:
super user you * //...
write user * * //...
to:
super user you * //...
read user * * //...
Now the entire repository is read-only to everyone except you. You can add additional lines as needed to make specific parts writable. See p4 help protect for more information.

Related

Best practices to prevent changes to certain files in perforce

What is a good way to prevent people from submitting changes to a file? I was thinking of two methods
p4 trigger with a python snippet that holds a dictionary with protected paths and warn the user that changes are not accepted any more for that file.
use a bot account to check-out the file and never check-in (sounds like a bad idea)
I was searching for "permanently lock file" however that is just to keep exclusive locks when a file is only to be authored by one user at a time.
Remove write access in the protection table. I.e. run p4 protect and then set up permissions for the path like:
write user * * -//depot/whatever/path/...
If you want users to be able to sync and/or open the file but not submit it, add another line afterward that grants read or open permission specifically. For example, to allow users to sync that path but not edit or submit you'd do:
write user * * -//depot/whatever/path/...
read user * * //depot/whatever/path/...

Perforce file(s) not in client view

I have setup a new Perforce server via docker. I have an admin user and I can connect to it successfully.
It is of course an empty server, so I created a new workspace called foo with the following view:
//depot/... //foo/depot/...
Adding any new file fails in:
/Users/test/workspace_foo/file - file(s) not in client view.
I found this problem hundreds of times, but I am beyond the step of missing to create a workspace view, still it does not work. Any idea what I am missing here?
I struggled hard on this. And I'm not sure if I finally understood the real cause why it's working now.
To me, it looks like you need to create the mapping with the three dots as expression in order to be able to create a more specific one.
Example Here
However, after I added the 'three-dot-mapping' I could finally add all my files without any trouble. What doubts me a little is that after I opened the Mapping again, my 'three-dot-mapping' disappeared, and it just showed me a mapping to the folder I added.
As I understood, you need the
//depot/... <-> /Users/test/workspace_foo/...
mapping in order to be able to create a
//depot/anotherFolder <-> /Users/test/workspace_foo/anotherFolder
mapping. Also make sure, that first you add a file / folder directly under /Users/test/workspace_foo/....
If anyone has further explanations for this, I look forward hearing them.
I'm going to assume that your workspace's root is /Users/test/workspace_foo. That's what //foo in your client view corresponds to:
Client: foo
Root: /Users/test/workspace_foo
View:
//depot/... //foo/depot/...
right? So that means that:
//depot/... <-> /Users/test/workspace_foo/depot/...
Sidebar: The p4 where command will show you the depot-syntax, client-syntax, and local-syntax version of any given path; use p4 where //... to see your entire client mapping with overlapping view entries disambiguated and client paths expanded to local syntax.
The local file you're trying to add is not within the local path of the client view you've defined, which is why you're getting the error file(s) not in client view. If you want to leave your view mapping the way it is, you'll need to move file into a path under /Users/test/workspace_foo/depot in order to be able to add it. Whatever path you create on the client relative to /Users/test/workspace_foo/depot will be created on the server relative to //depot.
If you want /Users/test/workspace_foo/file to map to //depot/file, then change your View like this:
Client: foo
Root: /Users/test/workspace_foo
View:
//depot/... //foo/...
which means that:
//depot/... <-> /Users/test/workspace_foo/...
and therefore:
/Users/test/workspace_foo/file <-> //depot/file

How can we avoid integrating changes from one branch to other in perforce?

I am new to perforce. I have a requirement to create a trigger to avoid integrating changes from one particular branch say 'branch_testing' to 'main' branch.
How can we do this? Could you please help?
If you want to absolutely prevent changes from going from branch_testing to main, you need to use the protections table and do one of two things:
Remove "read" access to branch_testing.
Remove "write" access to main.
Otherwise, even if you implement clever controls on the integrate command, there's nothing to stop a user from doing:
p4 sync branch_testing/...
p4 edit main/...
cp -r branch_testing main
p4 submit

Is there any way to prevent different users from delete other user's files in the same share folder (but they can create own new files)?

On ubuntu I have the following:
A folder: `shares`, pemissions 755, owner root:somegroup.
Users and groups:
user1 user2 (groupx)
user3 user4 (groupy)
user5 (groupz)
I need to give the users in groupx and groupy the permission to create their own data inside share folder, but every single user can ONLY delete what he created, nothing more.
groupz users can only read content of share without writing.
If that helps, may I get the answer in case of ignoring the groups (just taking care of that each single user can create, and ONLY delete his own created files)?
Can anyone help me how can I get that be giving the right permissions and owners? because nothing help came to my mind.
According to this topic this is not possible.
To create/remove files in some dir you need to have a wx permissions to its parent dir. The user can even delete a file that he is not able to read.
The only option I see is to create the subdirectories for each user, where only this user has write permission. (chmod 750)
//Edit:
It's possible!
I was not aware of the sticky bit:
chmod 1770 on parent dir.
This adds a requirement that only dir owner or file owner can delete a file inside.

Lock rptdesign file

I am trying to find out if it is possible to lock an rptdesign file.
The idea is to run a report as a service, but without being able to change the default parameters. I know I could just hide the parameter window but still the user could edit the rptdesign file and hard code new values.
Does anyone has any previous experience with this?
Is it possible to make an rptdesign file non-editable?
If you want to prevent users by modifying rptdesign file, you should do it on OS level to enable it only for certain users.
If you want to ensure that the report is not modified, you can add hidden field storing md5 sum from report file. I mean that this field can store md5sum from your report file on the disk. Then you can compare it with your original sum.
Anyway your problem is slightly different - you are expecting certain data from your customers and you want to be cheated by them. You can use the method with md5sum but it is rather the matter of trust to them here or any other possibility to access to their database than through the report (e.g. they can give you the direct access to the database or you can agree to store this data in your company, not theirs).
Let me know if this answer helps you better.

Resources