Forum: helpMonitor Forum | Start New Thread
By: Vicente Ruiz Jurado on 2016-07-28 15:15
fix-default-user-group-role.php (11) downloads
Finally it wasn't necessary to add new roles because these groups without roles were 'Deleted' groups.
Attached my script if helps somebody in the future...
Thanks indeed again.
PS: I'll send our theme ASAP.
By: Franck Villaume on 2016-07-28 05:33
about theme: create a feature request with your code source attached, zip or git patch.
I'd rather like the git patch if possible.
if exists: yes, $group->addUser($user_identifier, $role_id) is the right function to use.
if not : check Role.class.php, function create($role_name, $data, $new_project=false)
it will create the role and attach it to the project.
One remark about "$data". it is a multidimensional array like this:
where 'section_name' is described in RBACEngine.class.php
and 'ref_id' is the object id (group id, group_artefact_type id, ...)
and val is described in RBAC.php
By: Vicente Ruiz Jurado on 2016-07-27 11:24
Thanks for your suggestions. I'm a little bit "outdated" of the new fusion code, etc, so it's very helpful. Some minor questions:
if role exists: I'm thinking in something like: $group->addUser($form_unix_name,$role_id))
if not: what is the recommended way to add the default roles? In Group.class.php approve() I see that is copied from a template.
I see that our theme has some custom code that should be removed to be used by other forges, so, I'll do a generic version. Which is the preferred way to send it?
By: Franck Villaume on 2016-07-23 10:53
moving to 6.0.50 is nice but with some warning 6.0.50 is unstable. You may encounter bugs or regression.
the old script "fix_default_role.php" requires the "role" & "role_settings" tables. These tables have been drop by the "20120605-drop-obsolete.sql" migration script.
Can you check if the projects you are mentioning have linked roles?
If yes, you just need to link users to these roles. Check the pfo_user_role table.
If not, then you should do some PHP to create default role per project without roles, then link users to that default roles.
By the way, is the theme of ourproject available to be include into fusionforge sourcecode directly?
By: Vicente Ruiz Jurado on 2016-07-22 15:13
I've updated these days our old gforge 4 system to debian/jessie and fusionforge 6.0.50 (https://ourproject.org). I did all the migrations between 4 and 6 versions using the released debian packages.
The main problem that I found is that with the new RBAC system our old "Default" role (role_id=1 in old "role" table, or now old_role_id=1 in "pfo_role") wasn't migrated. As a result many (old) projects don't have members (so there a many projects without admins, etc).
I didn't detect this problem it in my migration tests :-/
Anyway, I have a copy of the old "user_group" table before the migration (was dropped in some point in the migration).
My initial plan is to:
1) restore the "user_group" table and data
2) make the migration of the old "Default" role to the new role system
3) drop again the old "user_group" table
but I'm not sure the better way to restore that role in the new system to get a consistent system.
I see that exists an old script called "fix_default_role.php" but seems that was not executed in our migration and now seems that is not functional.
Also I found that old_role_id=1 was not processed in (20100927-pfo-rbac.sql):
INSERT INTO pfo_user_role (SELECT DISTINCT ug.user_id, r.role_id FROM user_group ug, pfo_role r WHERE ug.role_id = r.old_role_id AND r.old_role_id != 1) ;
Thanks in advance, and thanks for your work with fusionforge,