FusionForge

RBAC

From FusionForge Wiki
(Redirected from Permissions)
Jump to: navigation, search

FusionForge uses the Role-Based Access Control or RBAC model for permissions.

Users don't have direct permissions; instead they have roles and each role has permissions.

When a user requests a restricted action, her roles are checked: if one of her roles has the required permisson, the action can go on. If none of her roles have the permission, the action is denied by default.

This RBAC implementation was designed as part of the Coclico project and more formally documented on http://wiki.planetforge.org/index.php/RBAC_API planetforge.org (local copy).

Roles

Roles have a class:

  • Implicit roles: hard-coded, applies on a whole class of users:
    • LoggedIn: grant rights to people with a current session ; grey area wrt SCM access
    • Anonymous: always available, to anonymous (non-logged-in) and identified users (cumulative with their other roles)
  • Explicit roles: directly assigned to a particular user. They can group users with similar permissions.

Roles also have a scope:

  • Global roles are forge-wide, not attached to a project in particular. This includes implicit roles. They also typically include a Forge admin and News admin role, configured to grant permissions on forge site administration and front page news approval respectively.
  • Project roles are attached to a specific base project. When a user is assigned a project role, she's considered as a member of the project. However, a project role can reference other projects (see "sharing a list of users" below). You can define a different role (with different permissions) for project admins, developers, managers, trainees, tech support, and so on.

Recap:

  • implicit & global (anonymous, loggedin)
  • explicit & global (forgeadmin, newsadmin, ... ; per-user)
  • explicit & !global (for a particular project ; per-user)

Sharing a list of users between projects

Global and project roles can be referenced ("linked to") from other projects, so that the same role (hence the same set of users) can be assigned permissions in multiple projects.

For instance, you can define a list of staff members; that list can be described as an explicit global role (a list of users). If that role is marked as shared, a project can reference it and grant it permissions (for instance, commit access), and not have to update membership when new people join the staff, or when employees leave.

This may also be used for projects / subprojects links, where all project admins are automatically admins of subprojects.

Permissions

Permissions are available for each FusionForge feature:

  • site permissions (assigned by site admins):
    • forge_admin: access to site administration, and on all projects and features
    • forge_stats: access to site statistics
    • forge_read: FIXME unused
    • approve_projects: can approve new projects
    • approve_news: can approve front page news
  • project permissions (assigned by project admins):
    • project admin: access to project administration and all project features
    • project_read: project visibility (useful for private projects)
    • tracker_admin/pm_admin/forum_admin: administration for trackers/task managers/forums
    • tracker/pm/forum: permission on a specific tracker/task manager/forum
    • new_tracker/new_pm/new_forum: default permissions for new trackers/task managers/forums
    • scm: source repositories (no/read-only/read-write)
    • docman: document manager
    • frs: file release system

Note that some permissions automatically grant others: "project admin" grants permissions on all project tools, so there's no point in adding or removing permissions from that role; similarly, "forge admin" grants all permissions on all parts of the forge.

Permissions related to anonymous access and access for non-members are handled with the Anonymous and LoggedIn roles. As a consequence, unlinking the Anonymous role from a project makes that project unavailable for people not logged in.

Pre-defining roles in Project Templates

Project templates are the place to define pre-defined project roles for various classes of users with different permissions, so that these will apply automatically to projects created from these templates.

For instance, a forge admin may prepare two templates : "Public Project Template" and "Private Project Template", for "public projects" and "private projects" resp. so that the visibility of the project to anonymous and logged in (non-member) users are respectively set to "visible" and "hidden". Thus, all projects created reusing these visibility permissions set in those templates will be either visible or hidden, only accessible to their members (i.e. those with another explicit role in the project, typically set with a "visible" visibility.

Also, one may typically wish to define more roles corresponding to non-admin members and admin members of the project. The default Project Template does only provide such an Admin role.

Should you wish to customize a project template so that its roles are similar to the traditional roles of gforge/fusionforge up to 5.1, there's a populate_template_project.php script ready for you.

Tables

Note: the pfo prefix is for PlanetForge.Org, where the spec for RBAC was designed.

  • pfo_role: list of roles
    • home_group_id: role ownership by this project (with implied role_project_refs project link), user project membership (through pfo_user_role), NULL means global role
    • is_public: role is shared, default to false
  • pfo_role_setting: role permissions, one row for each permission
    • ref_id: object the permission applies to (project, external project, forum ID, tracker ID...)
  • pfo_user_role: N*M relationship, what roles are available for each user
  • role_project_refs: link external roles to a project; linked role will also have pfo_role_setting entries for that project
  • pfo_role_class: could be hardcoded, provides a description for pfo_role.role_class (explicit/anonymous/logged-in)