Andr3as / Codiad-CodeGit

Git integration for Codiad
MIT License
26 stars 15 forks source link

How can I lock down the committer? #25

Closed deitch closed 9 years ago

deitch commented 9 years ago

When I commit changes the first time as a logged in user, it pops up a settings panel which asks for my username and email.

Same thing if I hit the "Settings" button in CodeGit.

Is there any way to lock it down if I don't want a user to override their login name?

Andr3as commented 9 years ago

No, there is no build-in way to achieve this. But with some small changes you can achieve this yourself: Version 0.5.8: Change this line to:

$settings = array('username' => $_SESSION['user'], 'email' => $_POST['email']);

Version 0.6.0: Insert after this line:

$settings['local_username'] = $_SESSION['user'];
$settings['username'] = $_SESSION['user'];

I didn't test this idea, if you have problems feel free to comment below.

deitch commented 9 years ago

That seems easy enough. The question is, do you want it be unchangeable for everyone, or an option set by admin?

Andr3as commented 9 years ago

With the way above it would be unchangeable for everyone. To create an option set by admin you could place the code in if-clauses and define a constant in config.php of CodeGit or common.php of Codiad:

define("git_username_allow_changes", true);

and

if (git_username_allow_changes) {
 /* ... */
}

A more dynamic way with a software frontend would be quite harder.

deitch commented 9 years ago

That does seem to make more sense.

deitch commented 9 years ago

I am going to create a branch and add it. Instead of doing it in config.php or common.php, I am going to use a parameter like we did with the repo-wide status https://github.com/Andr3as/Codiad-CodeGit/pull/28

deitch commented 9 years ago

Closing this issue in favour of the pull request https://github.com/Andr3as/Codiad-CodeGit/pull/29