List of commits:
Subject Hash Author Date (UTC)
Checkpoint after a lot of pause 53c17f78a3d70e22165de311ff56b094cb3b1096 Catalin(ux) M. BOIE 2014-04-14 18:23:27
Checkpoint - mostly fixes for tests and switch to sql_params 28830fcf28cf8f3ae0f59bf1205281820df1307a Catalin(ux) M. BOIE 2013-07-16 19:42:15
Bulk changes all over the place. 69bd7667ac66a02ae3734ddb2f1eb8eec526e3bf Catalin(ux) M. BOIE 2013-04-21 06:40:27
Fixed repo search: ui['admin'] may not be defined 48794821cb9a4ea8fa793144256ac916b1554bf2 Catalin(ux) M. BOIE 2013-02-18 19:37:31
Several changes. Bump version to 0.18 57269df7b88cd6cbb0c2569c6e14d94887c6ca40 Catalin(ux) M. BOIE 2013-02-17 10:10:48
Bump the version 753abba3b1f6caac8f96d801e5a5d1786023aa2f Catalin(ux) M. BOIE 2013-02-05 19:40:38
Checkpoint 16a893cae9b7754a3e9ff9a0f380c00ccc52a907 Catalin(ux) M. BOIE 2013-02-05 19:35:48
Bulk fixes 30f559c9d7701b0a06344f286f113e154a39805b Catalin(ux) M. BOIE 2013-01-06 00:24:33
Removed some debug stuff. d17e0d454e7e1cad1b350139e0770e7450ee9331 Catalin(ux) M. BOIE 2012-12-02 21:00:30
Apply conditionals before replacing variables! 3d5b7d5fcc11734f9623a3d6ff0aaa8a332b6bdb Catalin(ux) M. BOIE 2012-12-02 20:58:43
More fixes for 'fixes' infrastructure 831af837ca9e7fcf56bef81d1831c3150afa7de8 Catalin(ux) M. BOIE 2012-12-01 21:58:30
Fixes infrastructure; bug fixing c282b19dcb975b1e90a4eaacfe4c126364f6e054 Catalin(ux) M. BOIE 2012-12-01 21:01:23
First round of notifications 561943c9bfd37fcf2b3c53724af2c8145d76d664 Catalin(ux) M. BOIE 2012-11-18 12:03:28
Repo history added 888934152ff5c2f2dafae9e598cf93ab6f377dba Catalin(ux) M. BOIE 2012-11-09 22:39:08
git clone fixes and other stuff dbe6ddaddfc735c8a6fef126ba90cdb2a98fe631 Catalin(ux) M. BOIE 2012-11-07 19:19:38
Allow duplicate repo names. Allow same key (db pov). 146d1de07369f1e3270a6cdca1f1bead2d076f30 Catalin(ux) M. BOIE 2012-11-05 19:47:06
Bulk e15b8500a1ba4d1a84631287b234a661aa366cd6 Catalin(ux) M. BOIE 2012-11-05 18:39:16
Bulk updates - search, rights \!own fd52a1454efb598538244ac8b1117ee074d818cd Catalin(ux) M. BOIE 2012-10-31 22:08:29
Fix delete repo function 63e34cf9032bb7b108b51c97ccbd1efbd1e5cd7b Catalin(ux) M. BOIE 2012-10-29 20:45:40
Bulk 2ccd4da309196c89d776950b3b2e9efec32a6c60 Catalin(ux) M. BOIE 2012-10-29 18:30:20
Commit 53c17f78a3d70e22165de311ff56b094cb3b1096 - Checkpoint after a lot of pause
Author: Catalin(ux) M. BOIE
Author date (UTC): 2014-04-14 18:23
Committer name: Catalin(ux) M. BOIE
Committer date (UTC): 2014-04-14 18:23
Parent(s): 28830fcf28cf8f3ae0f59bf1205281820df1307a
Signer:
Signing key:
Signing status: N
Tree: ee4c09f75ba8f0eff5a558823c5d979df235a6ce
File Lines added Lines deleted
Certs.txt 1 1
Makefile.in 4 0
TODO 129 25
inc/admin/plans/plans.php 3 1
inc/bug.inc.php 29 14
inc/git.inc.php 2 1
inc/log.inc.php 2 2
inc/plan.inc.php 24 11
inc/repo.inc.php 39 21
inc/repo/repo.php 6 3
inc/rights.inc.php 7 7
inc/sess.inc.php 1 1
inc/struct.inc.php 25 0
inc/token.inc.php 1 1
inc/user.inc.php 13 8
inc/user/repo-page.php 2 3
inc/user/repo/admin/edit/edit.php 0 4
inc/user/repo/admin/rights/rights.php 9 1
inc/util.inc.php 4 1
inc/watch.inc.php 1 1
root/themes/default/admin/plans/add_edit.html 13 2
root/themes/default/admin/plans/add_ok.html 3 0
root/themes/default/admin/plans/list/header.html 3 0
root/themes/default/admin/plans/list/line.html 3 0
root/themes/default/hints/repo/create_repo.html 2 0
root/themes/default/hints/repo/edit_rights.html 10 1
root/themes/default/hints/repo/remote_add.html 1 1
root/themes/default/main.css 8 6
root/themes/default/main.html 1 1
root/themes/default/repo/add_edit.html 2 5
root/themes/default/repo/stats.html 1 1
root/themes/default/user/add_edit.html 4 11
root/themes/default/user/keys/list/nodata.html 1 1
root/themes/default/user/repo/rights/form.html 4 4
samples/config.php 1 1
scripts/remote.php 2 1
tests/bug.php 46 1
File Certs.txt changed (mode: 100644) (index 87c7a41..c4293c8)
... ... This document tries to find a way to get rid of authorized_keys file.
3 3 Certificates may be used for user (auth user to serv) or host authentication Certificates may be used for user (auth user to serv) or host authentication
4 4 (auth servers to users). (auth servers to users).
5 5
6 Certificate has a public key, identity information zero or more principal
6 Certificate has a public key, identity information, zero or more principal
7 7 (user or host) names and a set of options signed by CA key. (user or host) names and a set of options signed by CA key.
8 8
9 9 Generate a user cerificate: Generate a user cerificate:
File Makefile.in changed (mode: 100644) (index a13fbd1..01d625e)
... ... clean:
15 15 @find . -type f -name '*.log' -exec rm -f {} \; @find . -type f -name '*.log' -exec rm -f {} \;
16 16 @find . -type f -name '*.out' -exec rm -f {} \; @find . -type f -name '*.out' -exec rm -f {} \;
17 17
18 .PHONY: tests
19 tests:
20 make -C tests all
21
18 22 install: all install: all
19 23 @mkdir -p $(I_USR_SHARE)/$(PRJ) @mkdir -p $(I_USR_SHARE)/$(PRJ)
20 24 cp -vdr admin inc hooks root scripts $(I_USR_SHARE)/$(PRJ) cp -vdr admin inc hooks root scripts $(I_USR_SHARE)/$(PRJ)
File TODO changed (mode: 100644) (index cdb786f..c41a4fb)
1 [ ] Integrate max_public/private_repos into HL.
2 [ ] Allow specifying base language for a project.
3 [ ] Allow specifying license for a project.
4 [ ] When changind db structure, invalidate all caches.
5 [ ] Check with owasp about html escaping. I do now htmlspecialchars ->
6 db -> HTML:nl2br()
7 [ ] Log also the last IP used.
8
9 == Plans for repo redesign ==
10 Because we can have a project without a repository, for example only with
11 bugtracker, we need to redesign the interface.
12
13 We need to have projects, where you can attach: a repo, a bugtracker
14 and/or a mailing list.
15
16 We need rights to admin/create/delete/grant_rights against repo/bugtracker/mailing list.
17 Pay attention. A project has an owner. Without "admin" rights, you cannot
18 deal with the rest of
19 A project is public/private.
20 A repository/bt/ml link with a project.
21
22 We begin with an admin user. We have no projects, so no repo/bt/ml.
23 Admin user will create a user for a team-leader.
24 Two cases:
25 1. Allow user to create project
26 So, we need "CREATE PROJECTS" right.
27 2. Create project for him
28 So, what rights should we give to him? "ADMIN PROJECT"?
29 We should split"ADMIN" in finer rights: "DELETE PROJECT",
30 "CREATE/DELETE/LOCK REPO",
31 "CREATE/DELETE/LOCK BT",
32 "CREATE/DELETE/LOCK ML".
33 "LOCK" means that it will become read-only.
34
35 Now, team-leader has a project.
36 Two cases:
37 1. Give "CREATE REPO" rights to a team member.
38 2. Creates the repo and give rights to user.
39
1 40 == BEFORE NEXT RELEASE == == BEFORE NEXT RELEASE ==
41 [ ] Maybe add an indirection level: Projects. Because an admin may use
42 rocketgit only for the bug tracker, for example. Or only for mailing
43 list. So, "Repositories" will become "Projects". Hm.
44 [ ] 'first_install' value is not cached in RAM!
2 45 [ ] Seems that an annotated tag cannot be overwritten, even with rights. [ ] Seems that an annotated tag cannot be overwritten, even with rights.
3 46 [ ] Test bug.php is not working. Seems that repo_info is not working right for [ ] Test bug.php is not working. Seems that repo_info is not working right for
4 47 an inexistent repo_id! an inexistent repo_id!
5 48 [ ] From arora I cannot login! See a tcpdump. [ ] From arora I cannot login! See a tcpdump.
6 49 [ ] Rights management [ ] Rights management
7 - A user is trying to push some commits in a branch B, for a file F
50 - A user USER is trying to push some commits in a branch B,
51 for a file F
8 52 - The set of rights may be: - The set of rights may be:
9 53 Branch File/dir Rights Branch File/dir Rights
10 54 B2 dir/*.png FPA B2 dir/*.png FPA
 
17 61 private branch (refs/heads/USER/...). private branch (refs/heads/USER/...).
18 62 * USER/ ??? - give rights to any user to a * USER/ ??? - give rights to any user to a
19 63 private dir. private dir.
64 - "USER" is the user that is logged in. Maybe find a better string
65 because we may have a user "USER".
20 66 - Also limit by IP and by time. - Also limit by IP and by time.
21 67 - We have a problem: some rights do not map correctly to the plan above. - We have a problem: some rights do not map correctly to the plan above.
22 For example, A(admin)
68 For example, A(admin) etc. Seems we need to have >2 categories.
23 69 - Also, we will have problems classifying a project as public or private. - Also, we will have problems classifying a project as public or private.
24 70 Maybe we can compute the rights as an event after any rights change. Maybe we can compute the rights as an event after any rights change.
25 Maybe we should let the user what type of project it is, and, if is
26 public, to grant fetch right.
71 Maybe we should let the user choose what type of project it is, and,
72 if is public, to grant fetch right.
27 73 - Should I add "Create users right"? - Should I add "Create users right"?
74 - Repo rights: I should split admin into: "edit repo", "delete repo",
75 "give rights" (should limit to his rights), "fill bugs",
76 "close bugs",
77 - Repo rights: allow "*" as user: default rights.
78 - Very tempting to give up "register_rights" function and have the
79 form as template. But I have to list them, join them etc. Hm.
80 Think about translations, some time.
81 I could use a rights file: "<right><tab><category><tab><name>"
82 but this will duplicate the categories with translations.
83 Maybe have two files, one with "<right><tab><category>" and one
84 with "<right><tab><text>".
85 I decided to let them in php file, but replace text with a
86 translation lookup.
87 [ ] Remove 'admin' stuff. We will give normal rights.
88 [ ] We will use '*' = all rights, so we can extend the list and some users to
89 get them automatically.
90 [ ] You can grant the rights that you have, no more.
91 [ ] De scos 'rights' din user/add_edit.html
92 [ ] Allow comma separated users for grant rights.
93 [ ] Loading defaults for refs_rights seems to not working.
94 [ ] Secure transport X in configuratia de apache. Sau in index.php?
95 [ ]
28 96
29 == BEFORE NEXT RELEASE ==
30 [ ] Does it makes sense to have a local cache (user/repo/etc.) when we have
31 another local cache (cache.inc.php).
32 [ ] Search for "parmas" and "$e_".
33 [ ] Remove all db escaping after switching to params!
34 [ ] keys.inc.php - convert to params!
35 [ ] Switch from pg_query to pg_query_params.
36 [ ] Finish high level sql function.
37 [ ] When we escape, it will try to connect to database, that may fail.
38 This is not good at all and it seems a little bit hard to fix.
39 Maybe switch to prepared statements?
40 [ ] pg_fetch_assoc returns FALSE if error or no more rows.
41 We must know the difference!
97 == BEFORE NEXT-NEXT RELEASE ==
98 [ ] After resetting password, go to the login form, with user prefiled so the user can cache the password.
99 [ ] Add number of bugs multiplied with a value to total disk space.
100 [ ] How should I verify repo rights?
101 if (admin)
102 if (owner)
103 if (public)
104 pentru fiecare drept din lista ordonata dupa prioritati (putem avea mai multe din cauza ip/time/etc.)
105 verifica daca are dreptul
106 E valabil si pentru drepturi pe user?
107 Cum ar trebui sa arate tabela de drepturi? Cred ca e ok. misc poate
108 suporta drepturi ciudate.
109 Sa vedem cum arata acum:
110 type uid obj_id itime misc rights
111 Ar trebui sa avem si prioritatea in lista ca sa puetm ordona
112 dupa cum vrea user-ul.
113 Se pare ca rg_rights_load e folosit doar pentru repo si nu si pentru user.
114 rg_rights_set nu are notiunea de prio.
115 As vrea ca si owner-ul sa poata sa se limiteze la un anumit set de ip-uri.
116 Asta inseamna ca, din start, ar trebui sa adaug o regula pentru owner.
117 Sa incerc sa schitez partea de admin a user-ilor.
118
119 [ ] Do not pass a lot parameters in environment. Because of rights, we must
120 do a lookup in cache/db anyway. Or, compute correct rights (take in
121 account IP/time/etc.). No, because we need paths.
122 [ ] 'rg_rights_allow' needs a first parameter that is the set.
123 [ ] 'default_rights' must disappear. If repo is public, give basic rights.
124 Else, none. Must disappear only because we have two sets of rights now.
125 [ ] Repo rights were split in two. Check all rights checks! Maybe in check
126 function, verify that there is a possible right and if not internal_error.
127 [ ] Tree rights are a mess. User/Repo mixed rights.
128 [ ] "Create repositories" user right should not be in repo rights?
129 Probably not, because we may have no repo in the beginning.
130 [ ] I will have a csv document with translations from where I will build
131 some hash tables for fast lookups.
42 132 [ ] Check "suspend"/"make admin"/etc. in admin area. Maybe use a checkbox and [ ] Check "suspend"/"make admin"/etc. in admin area. Maybe use a checkbox and
43 133 an operation to avoid CSRF and to be consistent with ssh keys forms? an operation to avoid CSRF and to be consistent with ssh keys forms?
44 134 [ ] Fix rights saga on user side. We may remove user_allow and replace with [ ] Fix rights saga on user side. We may remove user_allow and replace with
45 135 rights_check? rights_check?
46 [ ] Riths use-cases:
47 [ ] An admin may not have "Remove" access.
48 [ ] An admin may not have "Suspend" access.
49 [ ] An admin may have only add/edit rights.
50 136 [ ] "Reset password" in admin area? [ ] "Reset password" in admin area?
51 137 [ ] "Make admin" will be replaced by "Edit"? [ ] "Make admin" will be replaced by "Edit"?
52 138 [ ] Problems trying to push to rg1 because of SELinux: [ ] Problems trying to push to rg1 because of SELinux:
 
75 161 [ ] Adding an account seems to just show "Account was created". [ ] Adding an account seems to just show "Account was created".
76 162 Maybe redirect to user page? Only if there is no need to confirm. Maybe redirect to user page? Only if there is no need to confirm.
77 163 What about lock_ip? What about lock_ip?
78 [ ] Where to check if plan exists (rg_user_edit_high_level).
164 [ ] Where to check if plan exists (rg_user_edit_high_level)?
79 165
80 166 == Medium == == Medium ==
167 [ ] Add hit/miss stats to caches.
168 [ ] If we have bug tracker, why not a mailing list?!
169 [ ] Allow comma separated users in (at least) rights grant.
170 [ ] Suggest some users on repo's "Grant rights". Maybe contributors?
171 [ ] Does it makes sense to have a local cache (user/repo/etc.) when we have
172 another local cache (cache.inc.php)? Pay attention to
173 invalidating/refreshing the cache. Hm.
174 Really-local one is faster for big lists. But, do we allow such big
175 lists without pagination?
176 [ ] pg_fetch_assoc returns FALSE if error or no more rows.
177 We must know the difference!
178 [ ] Finish high level sql function.
179 [ ] No caching for keys.php? If we add one, update first_use only if needed.
180 [ ] Rate limit at least login operations to prevent brute force passwords.
181 Because the attack may come from several IPs, it is tempting to
182 use target user for rate limit. But, we will prevent legitimate users
183 to login. Maybe just increase the delay for login? Maybe notify user
184 how many attempts were before succesful login.
185 [ ] remote.php: call keys_update_use from an event.
81 186 [ ] Allow user to change timezone! [ ] Allow user to change timezone!
82 187 [ ] Prea mult spatiu gol la notificarea de schimbare repo. [ ] Prea mult spatiu gol la notificarea de schimbare repo.
83 [ ] @@if: if after {{/}} follows a \n, just remove it?
188 [ ] @@if: if after {{/}} follows a \n, just remove it? Maybe only if the if
189 tokens are the only things on a line.
84 190 [ ] Think about moving unused tokens to a new session after login. [ ] Think about moving unused tokens to a new session after login.
85 191 [ ] Security: Edit info: user can chage the uid behind my back in form! [ ] Security: Edit info: user can chage the uid behind my back in form!
86 192 This is fixed with rg_user_allow_access. It should be used everywhere. This is fixed with rg_user_allow_access. It should be used everywhere.
 
153 259 [ ] We should have a log with logins, not only last_login per user. [ ] We should have a log with logins, not only last_login per user.
154 260 So, we should have an event on login and explode it in several queries. So, we should have an event on login and explode it in several queries.
155 261 Also session may be updated from this event, but still with a 1 min gap. Also session may be updated from this event, but still with a 1 min gap.
156 [ ] Max number of users must be removed from repo. No need for it.
157 262 [ ] Max commit size must be added per repo. [ ] Max commit size must be added per repo.
158 263 [ ] A script to check if all CSS classes in templates are present in css file. [ ] A script to check if all CSS classes in templates are present in css file.
159 264 [ ] Export/import a repo (xml maybe). [ ] Export/import a repo (xml maybe).
 
... ... them after processing is done.
394 499 [ ] I am not sure I can reload xinetd and httpd from spec file [ ] I am not sure I can reload xinetd and httpd from spec file
395 500 [ ] Check SELinux context on /var/lib/rocketgit [ ] Check SELinux context on /var/lib/rocketgit
396 501 [ ] admin: "Lock all accounts" and "Reset password for all accounts and send mail". [ ] admin: "Lock all accounts" and "Reset password for all accounts and send mail".
397 [ ] rg_repo_allow seems to not be used.
398 502 [ ] Get memory statistics from /proc. [ ] Get memory statistics from /proc.
399 503 [ ] Add support for refs/notes/ pushes. [ ] Add support for refs/notes/ pushes.
400 504 [ ] When logging _SERVER variables, log only the ones prefixed by ROCKETGIT_. [ ] When logging _SERVER variables, log only the ones prefixed by ROCKETGIT_.
File inc/admin/plans/plans.php changed (mode: 100644) (index 8c8874a..3c8a6e9)
... ... case 'list': // list
23 23 $_admin_plans .= rg_plan_list_high_level($db, $sid, $admin_more); $_admin_plans .= rg_plan_list_high_level($db, $sid, $admin_more);
24 24 break; break;
25 25
26 case 'add': // add
27 26 case 'edit': // edit case 'edit': // edit
27 $admin_more['id'] = empty($paras) ? 0 : array_shift($paras);
28 // no break here
29 case 'add': // add
28 30 $_admin_plans .= rg_plan_edit_high_level($db, $sid, $admin_more); $_admin_plans .= rg_plan_edit_high_level($db, $sid, $admin_more);
29 31 break; break;
30 32 } }
File inc/bug.inc.php changed (mode: 100644) (index 1cb7d2c..fadfa1a)
... ... function rg_bug_search($db, $repo_id, $uid, $q)
791 791 rg_log("bug_search: repo_id=$repo_id uid=$uid" rg_log("bug_search: repo_id=$repo_id uid=$uid"
792 792 . " q=" . rg_array2string($q)); . " q=" . rg_array2string($q));
793 793
794 $params = array($repo_id); $index = 2;
794 795 $add = array(); $add = array();
795 796 $limit = 25; $limit = 25;
796 797 $ret = FALSE; $ret = FALSE;
 
... ... function rg_bug_search($db, $repo_id, $uid, $q)
802 803 rg_bug_set_error("cannot lookup user (reported_by)"); rg_bug_set_error("cannot lookup user (reported_by)");
803 804 break; break;
804 805 } }
805 $add[] = "AND uid = " . $_ui['uid'];
806 $add[] = "AND uid = \$" . $index;
807 $params[] = $_ui['uid'];
808 $index++;
806 809 } }
807 810
808 811 // assigned to // assigned to
 
... ... function rg_bug_search($db, $repo_id, $uid, $q)
812 815 rg_bug_set_error("cannot lookup user (assigned_to)"); rg_bug_set_error("cannot lookup user (assigned_to)");
813 816 break; break;
814 817 } }
815 $add[] = "AND assigned_uid = " . $_ui['uid'];
818 $add[] = "AND assigned_uid = \$" . $index;
819 $params[] = $_ui['uid'];
820 $index++;
816 821 } }
817 822
818 823 // state // state
819 if (isset($q['state']) && ($q['state'] > 0))
820 $add[] = "AND state = " . $q['state'];
824 if (isset($q['state']) && ($q['state'] > 0)) {
825 $add[] = "AND state = \$" . $index;
826 $params[] = $q['state'];
827 $index++;
828 }
821 829
822 830 // start // start
823 831 if (!empty($q['start'])) { if (!empty($q['start'])) {
 
... ... function rg_bug_search($db, $repo_id, $uid, $q)
826 834 rg_bug_set_error("invalid start date format"); rg_bug_set_error("invalid start date format");
827 835 break; break;
828 836 } }
829 $add[] = "AND itime >= $ts";
837 $add[] = "AND itime >= \$" . $index;
838 $params[] = $ts;
839 $index++;
830 840 } }
831 841
832 842 // end // end
 
... ... function rg_bug_search($db, $repo_id, $uid, $q)
836 846 rg_bug_set_error("invalid end date format"); rg_bug_set_error("invalid end date format");
837 847 break; break;
838 848 } }
839 $add[] = "AND itime <= $ts";
849 $add[] = "AND itime <= \$" . $index;
850 $params[] = $ts;
851 $index++;
840 852 } }
841 853
842 854 // title_string // title_string
843 855 if (!empty($q['title_string'])) { if (!empty($q['title_string'])) {
844 $_t = rg_sql_escape($db, $q['title_string']);
845 $add[] = "AND title ILIKE '%" . $_t . "%'";
856 $add[] = "AND title ILIKE \$" . $index;
857 $params[] = "%" . $q['title_string'] . "%";
858 $index++;
846 859 } }
847 860
848 861 // body_string // body_string
849 862 if (!empty($q['body_string'])) { if (!empty($q['body_string'])) {
850 $_t = rg_sql_escape($db, $q['body_string']);
851 $add[] = "AND body ILIKE '%$" . $_t . "%'";
863 $add[] = "AND body ILIKE \$" . $index;
864 $params[] = "%" . $q['body_string'] . "%";
865 $index++;
852 866 } }
853 867
854 868 // bugs_per_page // bugs_per_page
 
... ... function rg_bug_search($db, $repo_id, $uid, $q)
862 876 break; break;
863 877 } }
864 878
865 $params = array($repo_id);
866 879 $sql = "SELECT * FROM bugs" $sql = "SELECT * FROM bugs"
867 880 . " WHERE repo_id = $1" . " WHERE repo_id = $1"
868 881 . " AND deleted = 0" . " AND deleted = 0"
 
... ... function rg_bug_label_insert($db, $repo_id, $bug_id, $labels)
1140 1153 } }
1141 1154
1142 1155 // TODO: switch to params // TODO: switch to params
1156 $params = array(); $index = 1;
1143 1157 $list = array(); $list = array();
1144 1158 foreach ($diff as $label) { foreach ($diff as $label) {
1145 $e_label = rg_sql_escape($db, $label);
1146 $list[] = "($repo_id, $bug_id, '$e_label')";
1159 $params[] = $label;
1160 $list[] = "($repo_id, $bug_id, \$" . $index . ")";
1161 $index++;
1147 1162 } }
1148 1163 $sql = "INSERT INTO bug_labels (repo_id, bug_id, label)" $sql = "INSERT INTO bug_labels (repo_id, bug_id, label)"
1149 1164 . " VALUES " . implode(", ", $list); . " VALUES " . implode(", ", $list);
1150 $res = rg_sql_query($db, $sql);
1165 $res = rg_sql_query_params($db, $sql, $params);
1151 1166 if ($res === FALSE) { if ($res === FALSE) {
1152 1167 rg_bug_set_error("Cannot insert labels (" . rg_sql_error() . ")"); rg_bug_set_error("Cannot insert labels (" . rg_sql_error() . ")");
1153 1168 break; break;
File inc/git.inc.php changed (mode: 100644) (index 602e361..f6d6de8)
... ... function rg_git_update_tag($a)
866 866 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
867 867 . " delete an annotated tag."); . " delete an annotated tag.");
868 868 } else { // change } else { // change
869 if (!rg_rights_allow($a['rights'], "N"))
869 rg_log("This seems it cannot happen in recent git.");
870 if (!rg_rights_allow($a['rights'], "S"))
870 871 rg_git_fatal($a['refname'] . "\nNo rights to" rg_git_fatal($a['refname'] . "\nNo rights to"
871 872 . " change an annotated tag."); . " change an annotated tag.");
872 873 } }
File inc/log.inc.php changed (mode: 100644) (index 30cafe9..5fab0c4)
... ... function rg_log_cron()
185 185
186 186 mail($rg_admin_email, $wcount . " + " . $ncount mail($rg_admin_email, $wcount . " + " . $ncount
187 187 . " errors are waiting...", . " errors are waiting...",
188 "Please forward the content of /var/log/rocketgit.*/err-.*"
189 . " to RocketGit developers at bugs@embedromix.ro.\n\n"
188 "Please forward the content of /var/log/rocketgit*/err-*"
189 . " to RocketGit developers at rg-bugs@embedromix.ro.\n\n"
190 190 . "Thank you!\n\n", . "Thank you!\n\n",
191 191 "", "-f $rg_admin_email"); "", "-f $rg_admin_email");
192 192
File inc/plan.inc.php changed (mode: 100644) (index 21c662b..c48167c)
... ... function rg_plan_edit($db, $d)
46 46
47 47 $params = array($d['name'], $d['description'], $d['disk_mb'], $params = array($d['name'], $d['description'], $d['disk_mb'],
48 48 $d['users'], $d['bw'], $d['speed'], $d['position'], $d['users'], $d['bw'], $d['speed'], $d['position'],
49 $d['id']);
49 $d['max_public_repos'], $d['max_private_repos']);
50 50 if ($d['id'] == 0) { // add if ($d['id'] == 0) { // add
51 51 $sql = "INSERT INTO plans (name, description, disk_mb" $sql = "INSERT INTO plans (name, description, disk_mb"
52 . ", users, bw, speed, position)"
53 . " VALUES ($1, $2, $3, $4, $5, $6, $7)"
52 . ", users, bw, speed, position"
53 . ", max_public_repos, max_private_repos)"
54 . " VALUES ($1, $2, $3, $4, $5, $6, $7, $8, $9)"
54 55 . " RETURNING id"; . " RETURNING id";
55 56 } else { // edit } else { // edit
57 $params[] = $d['id'];
56 58 $sql = "UPDATE plans" $sql = "UPDATE plans"
57 59 . " SET name = $1" . " SET name = $1"
58 60 . ", description = $2" . ", description = $2"
 
... ... function rg_plan_edit($db, $d)
61 63 . ", bw = $5" . ", bw = $5"
62 64 . ", speed = $6" . ", speed = $6"
63 65 . ", position = $7" . ", position = $7"
64 . " WHERE id = $8"
66 . ", max_public_repos = $8"
67 . ", max_private_repos = $9"
68 . " WHERE id = $10"
65 69 . " RETURNING id"; . " RETURNING id";
66 70 } }
67 71
 
... ... function rg_plan_list($db)
147 151 while (($row = rg_sql_fetch_array($res))) { while (($row = rg_sql_fetch_array($res))) {
148 152 $row['exists'] = 1; $row['exists'] = 1;
149 153 $id = $row['id']; $id = $row['id'];
154
155 // fixes
156 $row['HTML:description'] = nl2br($row['description']);
157 unset($row['description']);
158
150 159 $ret[$id] = $row; $ret[$id] = $row;
151 160 } }
152 161 rg_sql_free_result($res); rg_sql_free_result($res);
 
... ... function rg_plan_list_high_level($db, $sid, $more)
261 270 */ */
262 271 function rg_plan_edit_high_level($db, $sid, $more) function rg_plan_edit_high_level($db, $sid, $more)
263 272 { {
264 rg_log("plan_edit_high_level");
273 rg_log("plan_edit_high_level more:" . rg_array2string($more));
265 274
266 275 $doit = rg_var_uint("doit"); $doit = rg_var_uint("doit");
267 $plan_id = rg_var_uint("id");
276 $id = isset($more['id']) ? sprintf("%u", $more['id']) : 0;
268 277
269 278 $ret = ""; $ret = "";
270 279 $pi = array(); $pi = array();
271 280
272 281 if ($doit == 0) { if ($doit == 0) {
273 if ($plan_id > 0) {
274 $pi = rg_plan_info($db, $plan_id);
282 if ($id > 0) {
283 $pi = rg_plan_info($db, $id);
275 284 if ($pi['exists'] != 1) { if ($pi['exists'] != 1) {
276 285 $ret .= rg_warning("Invalid plan."); $ret .= rg_warning("Invalid plan.");
277 286 return $ret; return $ret;
278 287 } }
279 288 } else { } else {
280 // Defaults.
289 // Defaults
281 290 $pi['id'] = 0; $pi['id'] = 0;
282 291 $pi['name'] = ""; $pi['name'] = "";
283 292 $pi['description'] = ""; $pi['description'] = "";
 
... ... function rg_plan_edit_high_level($db, $sid, $more)
286 295 $pi['bw'] = "0"; $pi['bw'] = "0";
287 296 $pi['speed'] = "0"; $pi['speed'] = "0";
288 297 $pi['position'] = "100"; $pi['position'] = "100";
298 $pi['max_public_repos'] = "0";
299 $pi['max_private_repos'] = "0";
289 300 } }
290 301 } }
291 302
 
... ... function rg_plan_edit_high_level($db, $sid, $more)
296 307 break; break;
297 308
298 309 $pi = array(); $pi = array();
299 $pi['id'] = $plan_id;
310 $pi['id'] = $id;
300 311 $pi['name'] = rg_var_str("name"); $pi['name'] = rg_var_str("name");
301 312 $pi['description'] = rg_var_str("description"); $pi['description'] = rg_var_str("description");
302 313 $pi['disk_mb'] = rg_var_uint("disk_mb"); $pi['disk_mb'] = rg_var_uint("disk_mb");
 
... ... function rg_plan_edit_high_level($db, $sid, $more)
304 315 $pi['bw'] = rg_var_uint("bw"); $pi['bw'] = rg_var_uint("bw");
305 316 $pi['speed'] = rg_var_uint("speed"); $pi['speed'] = rg_var_uint("speed");
306 317 $pi['position'] = rg_var_uint("position"); $pi['position'] = rg_var_uint("position");
318 $pi['max_public_repos'] = rg_var_uint("max_public_repos");
319 $pi['max_private_repos'] = rg_var_uint("max_private_repos");
307 320 $token = rg_var_str("token"); $token = rg_var_str("token");
308 321
309 322 if (!rg_token_valid($db, $sid, $token)) { if (!rg_token_valid($db, $sid, $token)) {
 
... ... function rg_plan_edit_high_level($db, $sid, $more)
318 331 } }
319 332
320 333 // TODO: move to template. // TODO: move to template.
321 $ret = rg_ok("Plan was added with success.");
334 $ret .= rg_template("admin/plans/add_ok.html", $more);
322 335 $load_form = FALSE; $load_form = FALSE;
323 336 } while (0); } while (0);
324 337
File inc/repo.inc.php changed (mode: 100644) (index f566a7f..0b9f210)
... ... require_once($INC . "/rights.inc.php");
8 8 require_once($INC . "/prof.inc.php"); require_once($INC . "/prof.inc.php");
9 9 require_once($INC . "/events.inc.php"); require_once($INC . "/events.inc.php");
10 10
11 $rg_repo_rights = array(
12 "A" => "Admin",
11 $rg_repo_refs_rights = array(
13 12 "F" => "Fetch", "F" => "Fetch",
14 13 "P" => "Push", "P" => "Push",
15 14 "H" => "Anonymous push", "H" => "Anonymous push",
16 15 "S" => "Create annotated tag", "S" => "Create annotated tag",
17 "n" => "Delete annotated tag",
16 "n" => "Delete annotated tag", // Seems this cannot be deleted. Remove this from here!
18 17 "Y" => "Create un-annotated tag", "Y" => "Create un-annotated tag",
19 18 "U" => "Modify un-annotated tag", "U" => "Modify un-annotated tag",
20 19 "u" => "Delete un-annotated tag", "u" => "Delete un-annotated tag",
 
... ... $rg_repo_rights = array(
25 24 "W" => "Bad whitespace" "W" => "Bad whitespace"
26 25 ); );
27 26
27 // Admin = edit name/description/etc.
28 $rg_repo_rights = array(
29 "A" => "Access repo (read-only)", // this also define public/private
30 "E" => "Edit repo",
31 "D" => "Delete repo",
32 "G" => "Grant rights",
33 "a" => "Access bug tracker",
34 "X" => "Delete bug tracker",
35 "B" => "Add bugs",
36 "C" => "Close bugs"
37 );
38
28 39 // What rights are on by default // What rights are on by default
29 40 // TODO: this should go into conf file? // TODO: this should go into conf file?
30 $rg_repo_rights_default = "FMH";
41 // TODO: better move all config to database (modulo db conn info)?
42 $rg_repo_refs_rights_default = "FMH";
43 $rg_repo_rights_default = "B";
31 44
45 rg_rights_register("repo_refs", $rg_repo_refs_rights);
32 46 rg_rights_register("repo", $rg_repo_rights); rg_rights_register("repo", $rg_repo_rights);
33 47
34 48
 
... ... function rg_repo_set_error($str)
46 60 { {
47 61 global $rg_repo_error; global $rg_repo_error;
48 62 $rg_repo_error = $str; $rg_repo_error = $str;
63 rg_log($str);
49 64 } }
50 65
51 66 function rg_repo_error() function rg_repo_error()
 
... ... function rg_repo_info($db, $repo_id, $uid, $repo_name)
505 520 } }
506 521
507 522 /* /*
508 * Check if a user has access to repository
523 * Check if a user has access to a repository
509 524 */ */
510 525 function rg_repo_allow($db, $ri, $ui, $needed_rights) function rg_repo_allow($db, $ri, $ui, $needed_rights)
511 526 { {
 
... ... function rg_repo_allow($db, $ri, $ui, $needed_rights)
521 536 } }
522 537
523 538 if (empty($needed_rights)) { if (empty($needed_rights)) {
524 rg_log("\tNo perms passed!");
539 rg_internal_error("You asked for no rights!");
525 540 return FALSE; return FALSE;
526 541 } }
527 542
 
... ... function rg_repo_allow($db, $ri, $ui, $needed_rights)
557 572 * TODO: unify this function with rg_repo_update. * TODO: unify this function with rg_repo_update.
558 573 */ */
559 574 function rg_repo_create($db, $master, $ui, $name, $max_commit_size, function rg_repo_create($db, $master, $ui, $name, $max_commit_size,
560 $description, $rights, $max_users)
575 $description, $rights)
561 576 { {
562 577 rg_prof_start("repo_create"); rg_prof_start("repo_create");
563 578
 
... ... function rg_repo_create($db, $master, $ui, $name, $max_commit_size,
566 581 . ", name=[$name], master=$master" . ", name=[$name], master=$master"
567 582 . ", max_commit_size=$max_commit_size" . ", max_commit_size=$max_commit_size"
568 583 . ", description=[$description]" . ", description=[$description]"
569 . ", rights=$rights, max_users=$max_users...");
584 . ", rights=$rights");
570 585
571 586 // TODO: test if user is allowed to add a repository // TODO: test if user is allowed to add a repository
572 587
 
... ... function rg_repo_create($db, $master, $ui, $name, $max_commit_size,
588 603 $itime = time(); $itime = time();
589 604
590 605 $params = array($ui['uid'], $master, $name, $itime, $params = array($ui['uid'], $master, $name, $itime,
591 $max_commit_size, $description, $rights, $max_users);
606 $max_commit_size, $description, $rights);
592 607 $sql = "INSERT INTO repos (uid, master, name" $sql = "INSERT INTO repos (uid, master, name"
593 608 . ", itime, max_commit_size, description, git_dir_done" . ", itime, max_commit_size, description, git_dir_done"
594 . ", default_rights, max_users)"
595 . " VALUES ($1, $2, $3, $4, $5, $6, 0, $7, $8)"
609 . ", default_rights)"
610 . " VALUES ($1, $2, $3, $4, $5, $6, 0, $7)"
596 611 . " RETURNING repo_id"; . " RETURNING repo_id";
597 612 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
598 613 if ($res === FALSE) { if ($res === FALSE) {
 
... ... function rg_repo_update($db, $login_ui, &$new)
805 820
806 821 $params = array($new['name'], $new['max_commit_size'], $params = array($new['name'], $new['max_commit_size'],
807 822 trim($new['description']), $new['default_rights'], trim($new['description']), $new['default_rights'],
808 $new['max_users'], $new['repo_id']);
823 $new['repo_id']);
809 824 $sql = "UPDATE repos SET name = $1" $sql = "UPDATE repos SET name = $1"
810 825 . ", max_commit_size = $2" . ", max_commit_size = $2"
811 826 . ", description = $3" . ", description = $3"
812 827 . ", default_rights = $4" . ", default_rights = $4"
813 . ", max_users = $5"
814 . " WHERE repo_id = $6";
828 . " WHERE repo_id = $5";
815 829 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
816 830 if ($res === FALSE) { if ($res === FALSE) {
817 831 rg_repo_set_error("Cannot update (" . rg_sql_error() . ")"); rg_repo_set_error("Cannot update (" . rg_sql_error() . ")");
 
... ... function rg_repo_list($db, $url, $ui)
905 919 { {
906 920 rg_log("repo_list: url=$url, uid=" . $ui['uid']); rg_log("repo_list: url=$url, uid=" . $ui['uid']);
907 921
922 $params = array();
923 $index = 1;
924
908 925 $add = ""; $add = "";
909 if ($ui['uid'] > 0)
910 $add = " AND uid = $1";
926 if ($ui['uid'] > 0) {
927 $add = " AND uid = \$" . $index;
928 $params[] = $ui['uid'];
929 $index++;
930 }
911 931
912 $params = array($ui['uid']);
913 932 $sql = "SELECT * FROM repos" $sql = "SELECT * FROM repos"
914 933 . " WHERE deleted = 0" . " WHERE deleted = 0"
915 934 . $add . $add
 
... ... function rg_repo_search($db, $login_ui, $q)
931 950 if (isset($login_ui['admin']) && ($login_ui['admin'] == 1)) if (isset($login_ui['admin']) && ($login_ui['admin'] == 1))
932 951 $admin = 1; $admin = 1;
933 952
934 $params = array($q, $login_ui['uid']);
953 $params = array("%" . $q . "%", $login_ui['uid']);
935 954 $sql = "SELECT * FROM repos" $sql = "SELECT * FROM repos"
936 955 . " WHERE deleted = 0" . " WHERE deleted = 0"
937 . " AND (name ILIKE '%$1%' OR description ILIKE '%$1%')"
938 . " AND (uid = $2 OR default_rights LIKE '%F%'"
939 . " OR " . $admin . " = 1)"
956 . " AND (name ILIKE $1 OR description ILIKE $1)"
957 . " AND (uid = $2 OR default_rights LIKE '%F%' OR " . $admin . " = 1)"
940 958 . " ORDER BY master, name" . " ORDER BY master, name"
941 959 . " LIMIT 10"; . " LIMIT 10";
942 960
File inc/repo/repo.php changed (mode: 100644) (index 1edc485..5823907)
... ... if ($login_ui['uid'] == 0) {
11 11
12 12 $name = rg_var_str("name"); $name = rg_var_str("name");
13 13 $max_commit_size = rg_var_uint("max_commit_size"); $max_commit_size = rg_var_uint("max_commit_size");
14 $max_users = rg_var_uint("max_users");
15 14 $description = rg_var_str("description"); $description = rg_var_str("description");
16 15 $master_repo_id = rg_var_uint("master_repo_id"); $master_repo_id = rg_var_uint("master_repo_id");
17 16 $repo_id = rg_var_uint("repo_id"); $repo_id = rg_var_uint("repo_id");
 
... ... case 'create':
48 47
49 48 do { do {
50 49 $_r = rg_repo_create($db, $master_repo_id, $login_ui, $name, $_r = rg_repo_create($db, $master_repo_id, $login_ui, $name,
51 $max_commit_size, $description, $rights, $max_users);
50 $max_commit_size, $description, $rights);
52 51 if ($_r === FALSE) { if ($_r === FALSE) {
53 52 $errmsg[] = rg_repo_error(); $errmsg[] = rg_repo_error();
54 53 break; break;
 
... ... case 'create':
76 75 $repo_more['button'] = "Create"; $repo_more['button'] = "Create";
77 76 $repo_more['name'] = $name; $repo_more['name'] = $name;
78 77 $repo_more['max_commit_size'] = $max_commit_size; $repo_more['max_commit_size'] = $max_commit_size;
79 $repo_more['max_users'] = $max_users;
80 78 $repo_more['description'] = $description; $repo_more['description'] = $description;
81 79 $repo_more['master_repo_id'] = $master_repo_id; $repo_more['master_repo_id'] = $master_repo_id;
82 80 $repo_more['HTML:rights'] = rg_rights_checkboxes("repo", $rights); $repo_more['HTML:rights'] = rg_rights_checkboxes("repo", $rights);
83 81 $repo_more['repo_id'] = $repo_id; $repo_more['repo_id'] = $repo_id;
84 82 $repo_more['HTML:errmsg'] = rg_template_errmsg($errmsg); $repo_more['HTML:errmsg'] = rg_template_errmsg($errmsg);
85 83 $repo_more['rg_form_token'] = rg_token_get($db, $sid); $repo_more['rg_form_token'] = rg_token_get($db, $sid);
84
85 $hints = array();
86 $hints[]['HTML:hint'] = rg_template("hints/repo/create_repo.html", $repo_more);
87 $repo_more['HTML:hints'] = rg_template_table("hints/list", $hints, $repo_more);
88
86 89 $_repo .= rg_template("repo/add_edit.html", $repo_more); $_repo .= rg_template("repo/add_edit.html", $repo_more);
87 90 break; break;
88 91
File inc/rights.inc.php changed (mode: 100644) (index 8873b5a..2d4baaa)
... ... function rg_rights_a2s($a)
128 128 $rights = ""; $rights = "";
129 129
130 130 if (!is_array($a)) { if (!is_array($a)) {
131 rg_internal_error("Para is not an array");
131 rg_internal_error("Rights array is not an array");
132 132 return ""; return "";
133 133 } }
134 134
 
... ... function rg_rights_a2s($a)
138 138 return rg_rights_fix($rights); return rg_rights_fix($rights);
139 139 } }
140 140
141
142 141 /* /*
143 142 * Get rights for an object * Get rights for an object
143 * TODO: caching in RAM?
144 144 */ */
145 145 function rg_rights_get($db, $type, $obj_id, $uid) function rg_rights_get($db, $type, $obj_id, $uid)
146 146 { {
 
... ... function rg_rights_get($db, $type, $obj_id, $uid)
159 159 } }
160 160
161 161 $params = array($type, $uid, $obj_id); $params = array($type, $uid, $obj_id);
162 $sql = "SELECT itime, rights, misc FROM rights"
162 $sql = "SELECT itime, rights, misc, prio FROM rights"
163 163 . " WHERE type = $1" . " WHERE type = $1"
164 164 . " AND uid = $2" . " AND uid = $2"
165 165 . " AND obj_id = $3" . " AND obj_id = $3"
166 . " LIMIT 1";
166 . " ORDER BY prio";
167 167 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
168 168 if ($res === FALSE) { if ($res === FALSE) {
169 169 rg_rights_set_error("cannot get info (" . rg_sql_error() . ")!"); rg_rights_set_error("cannot get info (" . rg_sql_error() . ")!");
 
... ... function rg_rights_get($db, $type, $obj_id, $uid)
182 182 $ret['itime'] = $row['itime']; $ret['itime'] = $row['itime'];
183 183 $ret['rights'] = $row['rights']; $ret['rights'] = $row['rights'];
184 184 $ret['misc'] = empty($row['misc']) ? array() : unserialize($row['misc']); $ret['misc'] = empty($row['misc']) ? array() : unserialize($row['misc']);
185 $ret['prio'] = $row['prio'];
185 186 $ret['exists'] = 1; $ret['exists'] = 1;
186 187 } while (0); } while (0);
187 188
 
... ... function rg_rights_set($db, $type, $obj_id, $uid, $rights, $misc)
240 241 } }
241 242
242 243 /* /*
243 * Returns an array with the rights
244 * Returns an array with the rights, for all users
244 245 */ */
245 246 function rg_rights_load($db, $type, $obj_id) function rg_rights_load($db, $type, $obj_id)
246 247 { {
 
... ... function rg_rights_load($db, $type, $obj_id)
274 275 $row['itime_text'] = gmdate("Y-m-d H:i", $row['itime']); $row['itime_text'] = gmdate("Y-m-d H:i", $row['itime']);
275 276
276 277 // To avoid confusion // To avoid confusion
277 $row['right_uid'] = $row['uid'];
278 unset($row['uid']);
278 $row['right_uid'] = $row['uid']; unset($row['uid']);
279 279
280 280 $ret[] = $row; $ret[] = $row;
281 281 } }
File inc/sess.inc.php changed (mode: 100644) (index 44cfcb4..cbf461f)
... ... function rg_sess_update($db, $sess)
122 122 break; break;
123 123 } }
124 124
125 $params = array(time(), $sid);
125 $params = array(time(), $sess['sid']);
126 126 $sql = "UPDATE sess SET expire = $1 + session_time" $sql = "UPDATE sess SET expire = $1 + session_time"
127 127 . " WHERE sid = $2"; . " WHERE sid = $2";
128 128 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
File inc/struct.inc.php changed (mode: 100644) (index 4b0a720..8df7662)
... ... $rg_sql_struct[18]['other'] = array(
309 309 "key_first" => "ALTER TABLE keys ADD first_use INT NOT NULL DEFAULT 0" "key_first" => "ALTER TABLE keys ADD first_use INT NOT NULL DEFAULT 0"
310 310 ); );
311 311
312 $rg_sql_struct[19] = array();
313 $rg_sql_struct[19]['tables'] = array();
314 $rg_sql_struct[19]['other'] = array(
315 "rights_prio" => "ALTER TABLE rights ADD prio INT NOT NULL DEFAULT 0"
316 );
317
318 $rg_sql_struct[20] = array();
319 $rg_sql_struct[20]['tables'] = array();
320 $rg_sql_struct[20]['other'] = array(
321 "repo_drop_max_users" => "ALTER TABLE repos DROP max_users"
322 );
323
324 $rg_sql_struct[21] = array();
325 $rg_sql_struct[21]['tables'] = array();
326 $rg_sql_struct[21]['other'] = array(
327 "plans_max_public_repos" => "ALTER TABLE plans ADD max_public_repos INT NOT NULL DEFAULT 0",
328 "plans_max_private_repos" => "ALTER TABLE plans ADD max_private_repos INT NOT NULL DEFAULT 0"
329 );
330
331 $rg_sql_struct[22] = array();
332 $rg_sql_struct[22]['tables'] = array();
333 $rg_sql_struct[22]['other'] = array(
334 "users_last_ip" => "ALTER TABLE users"
335 . " ADD last_ip TEXT NOT NULL DEFAULT '?'"
336 );
312 337
313 338 // This must be the last line // This must be the last line
314 339 $rg_sql_schema_ver = count($rg_sql_struct); $rg_sql_schema_ver = count($rg_sql_struct);
File inc/token.inc.php changed (mode: 100644) (index 07e94a1..354ce7f)
... ... function rg_token_delete($db, $sid, $token)
38 38 $sql = "DELETE FROM tokens" $sql = "DELETE FROM tokens"
39 39 . " WHERE sid = $1" . " WHERE sid = $1"
40 40 . $add_token; . $add_token;
41 $res = rg_sql_query_parmas($db, $sql, $params);
41 $res = rg_sql_query_params($db, $sql, $params);
42 42 if ($res === FALSE) { if ($res === FALSE) {
43 43 rg_token_set_error("cannot delete token (" . rg_sql_error() . ")"); rg_token_set_error("cannot delete token (" . rg_sql_error() . ")");
44 44 return $ret; return $ret;
File inc/user.inc.php changed (mode: 100644) (index ffb18bf..724f6fb)
... ... require_once($INC . "/cache.inc.php");
9 9 require_once($INC . "/plan.inc.php"); require_once($INC . "/plan.inc.php");
10 10
11 11 $rg_user_rights = array( $rg_user_rights = array(
12 "C" => "Create repositories",
13 "U" => "Add/edit users",
14 "S" => "Suspend accounts",
15 "A" => "Up/downgrade to admin level",
16 "R" => "Remove account"
12 "C" => "Create repository",
13 "A" => "Create user",
14 "E" => "Edit user",
15 "R" => "Remove user",
16 "S" => "Suspend user",
17 "G" => "Grant rights"
17 18 ); );
18 19
19 20 rg_rights_register("user", $rg_user_rights); rg_rights_register("user", $rg_user_rights);
 
... ... function rg_user_suspend($db, $uid, $op)
811 812 else else
812 813 $v = 0; $v = 0;
813 814
814 $parmas = array($v, $uid);
815 $params = array($v, $uid);
815 816 $sql = "UPDATE users SET suspended = $1 WHERE uid = $2"; $sql = "UPDATE users SET suspended = $1 WHERE uid = $2";
816 817 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
817 818 if ($res === FALSE) { if ($res === FALSE) {
 
... ... function rg_user_set_last_seen($db, $uid)
868 869
869 870 $now = time(); $now = time();
870 871
871 $params = array($now, $uid);
872 $sql = "UPDATE users SET last_seen = $1 WHERE uid = $2";
872 $IP = $_SERVER['REMOTE_ADDR'];
873
874 $params = array($now, $IP, $uid);
875 $sql = "UPDATE users SET last_seen = $1, last_ip = $2 WHERE uid = $3";
873 876 $res = rg_sql_query_params($db, $sql, $params); $res = rg_sql_query_params($db, $sql, $params);
874 877 if ($res === FALSE) { if ($res === FALSE) {
875 878 rg_user_set_error("cannot update last seen (" . rg_sql_error() . ")"); rg_user_set_error("cannot update last seen (" . rg_sql_error() . ")");
 
... ... function rg_user_list($db)
911 914 $ret .= " <th>Confirmed?</th>\n"; $ret .= " <th>Confirmed?</th>\n";
912 915 $ret .= " <th>Session time</th>\n"; $ret .= " <th>Session time</th>\n";
913 916 $ret .= " <th>Last seen (UTC)</th>\n"; $ret .= " <th>Last seen (UTC)</th>\n";
917 $ret .= " <th>Last IP</th>\n";
914 918 $ret .= " <th>Rights</th>\n"; $ret .= " <th>Rights</th>\n";
915 919 $ret .= " <th>Operations</th>\n"; $ret .= " <th>Operations</th>\n";
916 920 $ret .= "</tr>\n"; $ret .= "</tr>\n";
 
... ... function rg_user_list($db)
932 936 $ret .= " <td>" . $row['session_time'] . "s</td>\n"; $ret .= " <td>" . $row['session_time'] . "s</td>\n";
933 937 $v = $row['last_seen'] == 0 ? "-" : gmdate("Y-m-d", $row['last_seen']); $v = $row['last_seen'] == 0 ? "-" : gmdate("Y-m-d", $row['last_seen']);
934 938 $ret .= " <td>" . $v . "</td>\n"; $ret .= " <td>" . $v . "</td>\n";
939 $ret .= " <td>" . $row['last_ip'] . "</td>\n";
935 940 $v = implode(", ", rg_rights_text("user", $row['rights'])); $v = implode(", ", rg_rights_text("user", $row['rights']));
936 941 $ret .= " <td>" . $v . "</td>\n"; $ret .= " <td>" . $v . "</td>\n";
937 942
File inc/user/repo-page.php changed (mode: 100644) (index 3ed4258..f4e096f)
... ... if ($ri['git_dir_done'] == 0) {
48 48 } }
49 49
50 50 // We must not allow access to a private repo (check for fetch) // We must not allow access to a private repo (check for fetch)
51 if (rg_repo_allow($db, $ri, $login_ui, "F") !== TRUE) {
51 if (rg_repo_allow($db, $ri, $login_ui, "A") !== TRUE) {
52 52 $_repo_page .= rg_warning("Not existent repo!"); $_repo_page .= rg_warning("Not existent repo!");
53 53 return; return;
54 54 } }
 
... ... $repo_more = array_merge($repo_more, $_t);
73 73 $repo_more = array_merge($repo_more, $ri); $repo_more = array_merge($repo_more, $ri);
74 74 $repo_more['default_rights'] = implode(", ", rg_rights_text("repo", $ri['default_rights'])); $repo_more['default_rights'] = implode(", ", rg_rights_text("repo", $ri['default_rights']));
75 75 $repo_more['max_commit_size'] = $ri['max_commit_size'] == 0 ? "unlimited" : rg_1024($ri['max_commit_size']); $repo_more['max_commit_size'] = $ri['max_commit_size'] == 0 ? "unlimited" : rg_1024($ri['max_commit_size']);
76 $repo_more['max_users'] = $ri['max_users'] == 0 ? "unlimited" : $ri['max_users'];
77 76 $repo_more['hints'] = ""; $repo_more['hints'] = "";
78 77
79 78 $repo_path = rg_repo_path_by_id($ri['uid'], $ri['repo_id']); $repo_path = rg_repo_path_by_id($ri['uid'], $ri['repo_id']);
 
... ... if (strcmp($_subop, "history") == 0) {
171 170 $_repo_body .= rg_template_table("repo/tree", $_tree, $_repo_body .= rg_template_table("repo/tree", $_tree,
172 171 $repo_more); $repo_more);
173 172 } }
174 } else { // log is default
173 } else {
175 174 // show the log // show the log
176 175 $log = rg_git_log($repo_path, 10, "", $ref, FALSE); $log = rg_git_log($repo_path, 10, "", $ref, FALSE);
177 176 if ($log === FALSE) { if ($log === FALSE) {
File inc/user/repo/admin/edit/edit.php changed (mode: 100644) (index ebece50..29e53bd)
... ... if (strcmp($_op, "rename_done") == 0) {
19 19 $name = rg_var_str("name"); $name = rg_var_str("name");
20 20 $rights = rg_rights_a2s(rg_var_str("rights")); $rights = rg_rights_a2s(rg_var_str("rights"));
21 21 $max_commit_size = rg_var_uint("max_commit_size"); $max_commit_size = rg_var_uint("max_commit_size");
22 $max_users = rg_var_uint("max_users");
23 22 $description = rg_var_str("description"); $description = rg_var_str("description");
24 23
25 24 do { do {
 
... ... if (strcmp($_op, "rename_done") == 0) {
42 41 $ri['max_commit_size'] = $max_commit_size; $ri['max_commit_size'] = $max_commit_size;
43 42 $ri['description'] = $description; // TODO: filter $ri['description'] = $description; // TODO: filter
44 43 $ri['default_rights'] = $rights; // TODO: filter $ri['default_rights'] = $rights; // TODO: filter
45 $ri['max_users'] = $max_users;
46 44 $_r = rg_repo_update($db, $_ui, $ri); $_r = rg_repo_update($db, $_ui, $ri);
47 45 if ($_r === FALSE) { if ($_r === FALSE) {
48 46 $errmsg[] = rg_repo_error(); $errmsg[] = rg_repo_error();
 
... ... if (strcmp($_op, "rename_done") == 0) {
65 63 $name = $ri['name']; $name = $ri['name'];
66 64 $rights = $ri['default_rights']; $rights = $ri['default_rights'];
67 65 $max_commit_size = $ri['max_commit_size']; $max_commit_size = $ri['max_commit_size'];
68 $max_users = $ri['max_users'];
69 66 $description = $ri['description']; $description = $ri['description'];
70 67 } }
71 68
 
... ... if ($_show_form == 1) {
84 81 $repo_edit_more['button'] = "Update"; $repo_edit_more['button'] = "Update";
85 82 $repo_edit_more['name'] = $name; $repo_edit_more['name'] = $name;
86 83 $repo_edit_more['max_commit_size'] = $max_commit_size; $repo_edit_more['max_commit_size'] = $max_commit_size;
87 $repo_edit_more['max_users'] = $max_users;
88 84 $repo_edit_more['description'] = $description; $repo_edit_more['description'] = $description;
89 85 $repo_edit_more['master_repo_id'] = $master_repo_id; $repo_edit_more['master_repo_id'] = $master_repo_id;
90 86 $repo_edit_more['HTML:rights'] = rg_rights_checkboxes("repo", $rights); $repo_edit_more['HTML:rights'] = rg_rights_checkboxes("repo", $rights);
File inc/user/repo/admin/rights/rights.php changed (mode: 100644) (index 5a0786b..464321f)
... ... $_rights = "";
6 6
7 7 $target_user = rg_var_str("target_user"); $target_user = rg_var_str("target_user");
8 8 $rights = rg_rights_a2s(rg_var_str("rights")); $rights = rg_rights_a2s(rg_var_str("rights"));
9 $refs_rights = rg_rights_a2s(rg_var_str("refs_rights"));
9 10 $delete = rg_var_uint("delete"); $delete = rg_var_uint("delete");
10 11 $edit_uid = rg_var_uint("edit_uid"); $edit_uid = rg_var_uint("edit_uid");
11 12 $grant = rg_var_uint("grant"); $grant = rg_var_uint("grant");
 
... ... $del_errmsg = array();
21 22
22 23 $repo_rights_more['target_user'] = $target_user; $repo_rights_more['target_user'] = $target_user;
23 24 $repo_rights_more['rights'] = $rights; $repo_rights_more['rights'] = $rights;
25 $repo_rights_more['refs_rights'] = $refs_rights;
26 $repo_rights_more['ref'] = $ref;
27 $repo_rights_more['path'] = $path;
24 28
25 29 $load_defaults = 1; $load_defaults = 1;
26 30
 
... ... do {
71 75
72 76 $repo_rights_more['target_user'] = $target_ui['username']; $repo_rights_more['target_user'] = $target_ui['username'];
73 77 $repo_rights_more['rights'] = $r['rights']; $repo_rights_more['rights'] = $r['rights'];
78 $repo_rights_more['refs_rights'] = $r['refs_rights'];
74 79 } while (0); } while (0);
75 80
76 81 // Adding // Adding
 
... ... do {
102 107 break; break;
103 108 } }
104 109
105 // no need to pre-fill user beause was just added
110 // no need to pre-fill user because was just added
106 111 $repo_rights_more['target_user'] = ""; $repo_rights_more['target_user'] = "";
107 112 $repo_rights_more['rights'] = ""; $repo_rights_more['rights'] = "";
113 $repo_rights_more['refs_rights'] = "";
108 114 } while (0); } while (0);
109 115
110 116 if ($load_defaults == 1) { if ($load_defaults == 1) {
111 117 $ref = ""; $ref = "";
112 118 $path = ""; $path = "";
113 119 $rights = $rg_repo_rights_default; $rights = $rg_repo_rights_default;
120 $refs_rights = $rg_repo_refs_rights_default;
114 121 } }
115 122
116 123 $repo_rights_more['rg_form_token'] = rg_token_get($db, $sid); $repo_rights_more['rg_form_token'] = rg_token_get($db, $sid);
117 124 $repo_rights_more['HTML:errmsg'] = rg_template_errmsg($errmsg); $repo_rights_more['HTML:errmsg'] = rg_template_errmsg($errmsg);
118 125 $repo_rights_more['HTML:del_errmsg'] = rg_template_errmsg($del_errmsg); $repo_rights_more['HTML:del_errmsg'] = rg_template_errmsg($del_errmsg);
119 126 $repo_rights_more['HTML:rights_checkboxes'] = rg_rights_checkboxes("repo", $rights); $repo_rights_more['HTML:rights_checkboxes'] = rg_rights_checkboxes("repo", $rights);
127 $repo_rights_more['HTML:refs_rights_checkboxes'] = rg_rights_checkboxes("repo_refs", $rights);
120 128
121 129 // list rights // list rights
122 130 $rights_list = rg_repo_rights_load($db, $ri); $rights_list = rg_repo_rights_load($db, $ri);
File inc/util.inc.php changed (mode: 100644) (index dbf987f..3f7c22f)
... ... function rg_template_table($dir, &$data, $more)
626 626 global $rg_theme_dir; global $rg_theme_dir;
627 627 global $rg_theme; global $rg_theme;
628 628
629 rg_log("rg_template_table: $dir");
630
629 631 $xdir = $rg_theme_dir . "/" . $rg_theme . "/" . $dir; $xdir = $rg_theme_dir . "/" . $rg_theme . "/" . $dir;
630 632 if (!is_dir($xdir)) { if (!is_dir($xdir)) {
631 633 rg_log("$xdir not found."); rg_log("$xdir not found.");
 
... ... function rg_template($file, &$data)
683 685 global $rg_theme_dir; global $rg_theme_dir;
684 686 global $rg_theme; global $rg_theme;
685 687
686 rg_log("Loading template from $file...");
688 rg_log("rg_template: $file");
687 689
688 690 $xfile = $rg_theme_dir . "/" . $rg_theme . "/" . $file; $xfile = $rg_theme_dir . "/" . $rg_theme . "/" . $file;
689 691 if (!is_file($xfile)) if (!is_file($xfile))
 
... ... function rg_warning($msg)
760 762
761 763 /* /*
762 764 * Show an OK message using a template * Show an OK message using a template
765 * TODO: OBSOLETE? Because we want the files to be in templates?
763 766 */ */
764 767 function rg_ok($msg) function rg_ok($msg)
765 768 { {
File inc/watch.inc.php changed (mode: 100644) (index aafb8fb..f6190b3)
... ... function rg_watch_add($db, $type, $login_uid, $obj_id1, $obj_id2)
98 98 $sql = "INSERT INTO watch_bug (uid, repo_id, bug_id)" $sql = "INSERT INTO watch_bug (uid, repo_id, bug_id)"
99 99 . " VALUES ($1, $2, $3)"; . " VALUES ($1, $2, $3)";
100 100 } else if (strcmp($type, "repo") == 0) { } else if (strcmp($type, "repo") == 0) {
101 $parmas = array($login_uid, $obj_id1);
101 $params = array($login_uid, $obj_id1);
102 102 $sql = "INSERT INTO watch_repo (uid, repo_id)" $sql = "INSERT INTO watch_repo (uid, repo_id)"
103 103 . " VALUES ($1, $2)"; . " VALUES ($1, $2)";
104 104 } else { } else {
File root/themes/default/admin/plans/add_edit.html changed (mode: 100644) (index b41f39b..8956b5c)
1 @@DUMP@@
1 2 <div class="formarea"> <div class="formarea">
2 3
3 4 <div class="formarea_title">@@if(@@id@@ == 0){{Add a new plan}}{{Edit plan}}</div><br /> <div class="formarea_title">@@if(@@id@@ == 0){{Add a new plan}}{{Edit plan}}</div><br />
 
20 21 <br /> <br />
21 22
22 23 <label for="description" class="form_item_title">Description</label><br /> <label for="description" class="form_item_title">Description</label><br />
23 <textarea name="description" value="@@description@@" rows="4" cols="50"></textarea>
24 <textarea name="description" rows="4" cols="50">@@description@@</textarea>
24 25 <br /> <br />
25 26 <br /> <br />
26 27
27 <label for="disk_mb" class="form_item_title">Maximum disk space (0 = unlimited)</label><br />
28 <label for="disk_mb" class="form_item_title">Maximum disk space (MiB, 0 = unlimited)</label><br />
28 29 <input type="text" name="disk_mb" value="@@disk_mb@@" /> <input type="text" name="disk_mb" value="@@disk_mb@@" />
29 30 <br /> <br />
30 31 <br /> <br />
 
44 45 <br /> <br />
45 46 <br /> <br />
46 47
48 <label for="max_public_repos" class="form_item_title">Maximum number of public repos (0 = unlimited)</label><br />
49 <input type="text" name="max_public_repos" value="@@max_public_repos@@" />
50 <br />
51 <br />
52
53 <label for="max_private_repos" class="form_item_title">Maximum number of private repos (0 = unlimited)</label><br />
54 <input type="text" name="max_private_repos" value="@@max_private_repos@@" />
55 <br />
56 <br />
57
47 58 <input type="submit" name="button" value="@@if(@@id@@ == 0){{Add}}{{Edit}}" /> <input type="submit" name="button" value="@@if(@@id@@ == 0){{Add}}{{Edit}}" />
48 59
49 60 </form> </form>
File root/themes/default/admin/plans/add_ok.html added (mode: 100644) (index 0000000..870a1b6)
1 <div class="ok">
2 Plan was added/edited with success.
3 </div>
File root/themes/default/admin/plans/list/header.html changed (mode: 100644) (index 6567679..fe3a61b)
16 16 <th>Speed (kbit/s)</th> <th>Speed (kbit/s)</th>
17 17 <th>Bandwidth (MiB/month)</th> <th>Bandwidth (MiB/month)</th>
18 18 <th>Disk (MiB)</th> <th>Disk (MiB)</th>
19 <th>Max public repos</th>
20 <th>Max private repos</th>
21 <th>Operations</th>
19 22 </tr> </tr>
20 23
File root/themes/default/admin/plans/list/line.html changed (mode: 100644) (index fc6609c..34d0261)
8 8 <td>@@if(@@speed@@ == 0){{Unlimited}}{{@@speed@@}}</td> <td>@@if(@@speed@@ == 0){{Unlimited}}{{@@speed@@}}</td>
9 9 <td>@@if(@@bw@@ == 0){{Unlimited}}{{@@bw@@}}</td> <td>@@if(@@bw@@ == 0){{Unlimited}}{{@@bw@@}}</td>
10 10 <td>@@if(@@disk_mb@@ == 0){{Unlimited}}{{@@disk_mb@@}}</td> <td>@@if(@@disk_mb@@ == 0){{Unlimited}}{{@@disk_mb@@}}</td>
11 <td>@@if(@@max_public_repos@@ == 0){{Unlimited}}{{@@max_public_repos@@}}</td>
12 <td>@@if(@@max_private_repos@@ == 0){{Unlimited}}{{@@max_private_repos@@}}</td>
13 <td><a href="@@url@@/edit/@@id@@">[Edit]</a></td>
11 14 </tr> </tr>
12 15
File root/themes/default/hints/repo/create_repo.html added (mode: 100644) (index 0000000..d500d47)
1 "Max commit size" is an optional protection against committing unwanted types
2 of files (binaries, images etc.).
File root/themes/default/hints/repo/edit_rights.html changed (mode: 100644) (index 4dc1ed2..75f132b)
1 1 You do not have to grant yourself rights.<br /> You do not have to grant yourself rights.<br />
2 You are the owner, so you have maximum rights.
2 You are the owner, so you have maximum rights.<br />
3 <br />
4
5 Bad whitespace: if checked, commits with mixed tabs and spaces, trailing
6 spaces/tabs etc. will be allowed.<br />
7 <br />
8
9 Example rights for references:<br />
10 refs/heads/x * Fetch + Push = Allow user to fetch/push in private namespace 'x'<br />
11 {USER} * Fetch + Push + Create branch+Delete branch = Logged in user 'USER' has rights to refs/heads/USER<br />
File root/themes/default/hints/repo/remote_add.html changed (mode: 100644) (index 46ffbaf..c48004d)
1 You have the project locally, but not in a Git repository:<br />
1 If you have the project locally, but not versioned with Git:<br />
2 2 <code> <code>
3 3 cd local_dir<br /> cd local_dir<br />
4 4 git init<br /> git init<br />
File root/themes/default/main.css changed (mode: 100644) (index 108e6b2..562db34)
... ... code {
34 34 } }
35 35
36 36 form input[type="text"], form input[type="password"], form textarea, form select, form checkbox { form input[type="text"], form input[type="password"], form textarea, form select, form checkbox {
37 border: 2px solid #DDDDDD;
37 border: 1px solid #CCCCCC;
38 38 font-size: 10pt; font-size: 10pt;
39 padding: 2px;
39 padding: 1px;
40 40 } }
41 form select option { padding: 3px; }
41 form select option { padding: 1px 4px 1px 4px; }
42 42 form input[type="submit"] { form input[type="submit"] {
43 43 color: #FF0000; color: #FF0000;
44 44 display: inline-block; display: inline-block;
45 45 font-weight: bold; font-weight: bold;
46 46 font-size: 10pt; font-size: 10pt;
47 padding: 2px 4px 2px 4px;
47 padding: 1px 4px 1px 4px;
48 48 cursor: pointer; cursor: pointer;
49 border: 2px solid #DDDDDD;
50 background-image: -moz-linear-gradient(top, #EEEEEE, #CCCCCC);
49 border: 1px solid #CCCCCC;
50 background-image: -moz-linear-gradient(top, #EEEEEE, #DDDDDD);
51 margin-top: 2px;
52 margin-bottom: 2px;
51 53 } }
52 54
53 55 #container { } #container { }
File root/themes/default/main.html changed (mode: 100644) (index 721ac54..ad4b767)
2 2 <h1>Welcome to RocketGit!</h1> <h1>Welcome to RocketGit!</h1>
3 3 <br /> <br />
4 4
5 Our target is to be the best FLOSS software for managing Git projects.
5 Our target is to become the best FLOSS software for managing Git projects.
6 6 With your help, we will do it. Thanks!<br /> With your help, we will do it. Thanks!<br />
7 7 <br /> <br />
8 8 You can create an account <a href="/op/create_account">here</a>.<br /> You can create an account <a href="/op/create_account">here</a>.<br />
File root/themes/default/repo/add_edit.html changed (mode: 100644) (index 62c4daf..227d09d)
22 22 <br /> <br />
23 23 <br /> <br />
24 24
25 <label for="max_users" class="form_item_title">Max number of users</label><br />
26 <input type="text" name="max_users" value="@@max_users@@" />
27 <br />
28 <br />
29
30 25 <label for="description" class="form_item_title">Description</label><br /> <label for="description" class="form_item_title">Description</label><br />
31 26 <textarea name="description" rows="4" cols="30">@@description@@</textarea> <textarea name="description" rows="4" cols="30">@@description@@</textarea>
32 27 <br /> <br />
 
42 37
43 38 </form> </form>
44 39 </div> </div>
40
41 @@hints@@
File root/themes/default/repo/stats.html changed (mode: 100644) (index 9cd7f6d..8be9ac2)
1 Not yet implemented. Sorry.
1 Not yet implemented. Any feedback about this is appreciated.
File root/themes/default/user/add_edit.html changed (mode: 100644) (index 20ed0bb..3a9f2d1)
9 9 <input type="hidden" name="doit" value="1" /> <input type="hidden" name="doit" value="1" />
10 10 <input type="hidden" name="token" value="@@rg_form_token@@" /> <input type="hidden" name="token" value="@@rg_form_token@@" />
11 11
12 <label for="username" class="form_item_title">User name</label><br />
12 <label for="username" class="form_item_title">User name (public)</label><br />
13 13 <input type="text" name="username" value="@@username@@" /> <input type="text" name="username" value="@@username@@" />
14 14 <br /> <br />
15 15 <br /> <br />
 
19 19 <br /> <br />
20 20 <br /> <br />
21 21
22 <label for="email" class="form_item_title">E-mail</label><br />
22 <label for="email" class="form_item_title">E-mail (not public)</label><br />
23 23 <input type="text" name="email" value="@@email@@" /> <input type="text" name="email" value="@@email@@" />
24 24 <br /> <br />
25 25 <br /> <br />
 
40 40 @@if(@@admin_mode@@ == 1){{ @@if(@@admin_mode@@ == 1){{
41 41 <label for="is_admin" class="form_item_title">Admin?</label><br /> <label for="is_admin" class="form_item_title">Admin?</label><br />
42 42 <select name="is_admin"> <select name="is_admin">
43 <option value="0"@@if(@@is_admin@@ == 0){{ selected="selected"}}{{}}>No</option>
44 <option value="1"@@if(@@is_admin@@ == 1){{ selected="selected"}}{{}}>Yes</option>
43 <option value="0"@@if(@@is_admin@@ == 0){{ selected="selected"}}{{}}>No, I will give rights later</option>
44 <option value="1"@@if(@@is_admin@@ == 1){{ selected="selected"}}{{}}>Yes, will have full access</option>
45 45 </select> </select>
46 46 <br /> <br />
47 47 <br /> <br />
48 48
49 <label for="rights" class="form_item_title">Rights</label><br />
50 @@checkbox_rights@@
51 <br />
52 <br />
53 }}
54 {{}}
55
56 49 <label for="plan" class="form_item_title">Plan</label><br /> <label for="plan" class="form_item_title">Plan</label><br />
57 50 @@select_plan@@ @@select_plan@@
58 51 <br /> <br />
File root/themes/default/user/keys/list/nodata.html changed (mode: 100644) (index 7334adb..1e0d7fb)
1 1 <div class="warning"> <div class="warning">
2 No key uploaded yet.
2 No keys uploaded yet.
3 3 </div> </div>
File root/themes/default/user/repo/rights/form.html changed (mode: 100644) (index d119635..6b26feb)
8 8 <input type="hidden" name="grant" value="1" /> <input type="hidden" name="grant" value="1" />
9 9 <input type="hidden" name="token" value="@@rg_form_token@@" /> <input type="hidden" name="token" value="@@rg_form_token@@" />
10 10
11 <label class="form_item_title" for="target_user">User</label><br />
11 <label class="form_item_title" for="target_user">User (use '*' for any user)</label><br />
12 12 <input type="text" name="target_user" value="@@target_user@@" /> <input type="text" name="target_user" value="@@target_user@@" />
13 13 <br /> <br />
14 14 <br /> <br />
15 15
16 16 <table> <table>
17 17 <tr> <tr>
18 <th>For repo</th>
19 <th>For refs</th>
18 <th>For repository</th>
19 <th>For references</th>
20 20 </tr> </tr>
21 21
22 22 <tr> <tr>
 
37 37 <br /> <br />
38 38
39 39 <label class="form_item_title" for="rights">Rights</label><br /> <label class="form_item_title" for="rights">Rights</label><br />
40 @@rights_checkboxes@@
40 @@refs_rights_checkboxes@@
41 41 <br /> <br />
42 42 </td> </td>
43 43 </tr> </tr>
File samples/config.php changed (mode: 100644) (index 8da6a03..827ebb3)
... ... $rg_ssh_host = "x.company.tld";
75 75 // SSH port - put 0 to disable // SSH port - put 0 to disable
76 76 $rg_ssh_port = 22; $rg_ssh_port = 22;
77 77
78 // Git port - put 0 to disable
78 // Git port - put 0 to disable (standard is 9418)
79 79 $rg_git_port = 9418; $rg_git_port = 9418;
80 80
81 81 ?> ?>
File scripts/remote.php changed (mode: 100644) (index 8ff6a4d..8589194)
... ... if (isset($_SERVER['SSH_CONNECTION'])) {
129 129 $ip = getenv("REMOTE_HOST"); $ip = getenv("REMOTE_HOST");
130 130 } }
131 131
132 // extract command and compute permissions
132 // Extracts command and computes permissions
133 133 if (strncmp($cmd_repo, "git-upload-pack", 15) == 0) { if (strncmp($cmd_repo, "git-upload-pack", 15) == 0) {
134 134 $cmd = "git-upload-pack"; $cmd = "git-upload-pack";
135 135 $needed_rights = "F"; $needed_rights = "F";
136 136 $push = 0; $push = 0;
137 137 } else if (strncmp($cmd_repo, "git-receive-pack", 16) == 0) { } else if (strncmp($cmd_repo, "git-receive-pack", 16) == 0) {
138 138 $cmd = "git-receive-pack"; $cmd = "git-receive-pack";
139 // TODO: add a comment here why we need to check nothing
139 140 $needed_rights = ""; $needed_rights = "";
140 141 $push = 1; $push = 1;
141 142 } else { } else {
File tests/bug.php changed (mode: 100644) (index 394babe..55fccf9)
... ... if ($repo_id === FALSE) {
57 57 $data = array("bug_id" => 0, $data = array("bug_id" => 0,
58 58 "title" => "Bug title", "title" => "Bug title",
59 59 "body" => "This is the body\nof the\nbug. <>", "body" => "This is the body\nof the\nbug. <>",
60 "labels" => "label1,label2,label3",
60 "labels" => "label3,label1,label2",
61 61 "state" => 1, "state" => 1,
62 62 "assigned_uid" => 6); "assigned_uid" => 6);
63 63 $ri = array("repo_id" => $repo_id, "name" => "repoX"); $ri = array("repo_id" => $repo_id, "name" => "repoX");
 
... ... if ($r === FALSE) {
67 67 exit(1); exit(1);
68 68 } }
69 69 $bug_id = $r; $bug_id = $r;
70 // verify that labels were inserted
71 $r = rg_bug_label_get($db, $repo_id, $bug_id);
72 if ($r === FALSE) {
73 rg_log("Cannot get labels (" . rg_bug_error() . ")!");
74 exit(1);
75 }
76 if (strcmp($r[0], "label1") != 0) {
77 rg_log("Ordering the labels seems to not work.");
78 exit(1);
79 }
80 if (strcmp($r[2], "label3") != 0) {
81 rg_log("Ordering the labels seems to not work.");
82 exit(1);
83 }
70 84
71 85 // add user // add user
72 86 $_u['uid'] = 0; $_u['uid'] = 0;
 
... ... if ($r['exists'] != 0) {
114 128 exit(1); exit(1);
115 129 } }
116 130
131 // Search bugs
132 $q = array("reported_by" => "userA",
133 "assigned_to" => "userA",
134 "state" => "1",
135 "start" => "2000-01-01",
136 "end" => "2001-01-01",
137 "title_string" => "IMPOSSIBLE TITLE",
138 "body_string" => "IMPOSSIBLE BODY",
139 "bugs_per_page" => "1");
140 $r = rg_bug_search($db, $repo_id, $uid, $q);
141 if ($r === FALSE) {
142 rg_log("Cannot search bugs 1 (" . rg_bug_error() . ")!");
143 exit(1);
144 }
145 if (count($r) > 0) {
146 rg_log("Search 1 returned a bug but the filtering should not allow it!");
147 exit(1);
148 }
149
150 $q = array("title_string" => "g t",
151 "body_string" => "");
152 $r = rg_bug_search($db, $repo_id, $uid, $q);
153 if ($r === FALSE) {
154 rg_log("Cannot search bugs 2 (" . rg_bug_error() . ")!");
155 exit(1);
156 }
157 if (count($r) == 0) {
158 rg_log("Search 2 did not returned a bug we were expecting!");
159 exit(1);
160 }
161
117 162 rg_sql_close($db); rg_sql_close($db);
118 163
119 164 echo "bug: OK!\n"; echo "bug: OK!\n";
Hints:
Before first commit, do not forget to setup your git environment:
git config --global user.name "your_name_here"
git config --global user.email "your@email_here"

Clone this repository using HTTP(S):
git clone https://rocketgit.com/user/catalinux/rocketgit

Clone this repository using ssh (do not forget to upload a key first):
git clone ssh://rocketgit@ssh.rocketgit.com/user/catalinux/rocketgit

Clone this repository using git:
git clone git://git.rocketgit.com/user/catalinux/rocketgit

You are allowed to anonymously push to this repository.
This means that your pushed commits will automatically be transformed into a merge request:
... clone the repository ...
... make some changes and some commits ...
git push origin main