Skip to content

Added public user index and visibility level to users

Matthias Käppler requested to merge github/fork/booktree/public-user into master

Created by: cirosantilli

Note: the pull request changed a lot after the third commit so I decided to change the description. Before the third commit, there was only the public index. After the 3rd commit, users now have visibility levels.

Behaviour changes

Users have visibility levels with semantics completely analogous to that of projects.

If an user is visible to another, it gets listed on the public area, and his profile page (/u/someuser) can be seen.

Currently, if a user is private only himself can see his profile page. Maybe in the future we can allow private users to let only selected users see their profile.

The default user visibility level is internal so that the current visibility behaviour does not change: only logged in users can see profile pages of other users. A configuration option was added to control the default level user visibility level: gitlab:user_default_visibility_level.

Use cases

Since the feature is completely analogous to "public projects", the use cases are the same:

  • find the profile of users which you only know by real name
  • open up the next step which will make the feature shine: add user gamification/metrics/analytics like Stackoverflow does, but for real projects. We can start with simple things like stars on owned projects and number of accepted pull request lines, but the sky is the limit.

Screenshots

Here goes screenshots of everything that changed on the UI:

public/users: new page, analogous to public/projects but for users. This is the main goal of the PR.

screenshot from 2014-01-16 10 07 48 public users

users/sign_in: says "browse the public area" instead of "public projects"

screenshot from 2014-01-16 10 08 06 users sign_in

u/someuser:

  • possible to view public users while not logged in
  • a visibility level icon shows besides the name

screenshot from 2014-01-16 10 48 54 u someuser

help: "Public Access" was moved under "Use Documentation" since it is relevant to any user, not just admins.

screenshot from 2014-01-16 10 06 58 help

help/public_access: completelly refactored. Also explains user visibility levels.

screenshot from 2014-01-16 10 07 15 help public access

profile/account: possible to edit visibility level

screenshot from 2014-01-16 10 14 24 profile account

admin/users:

  • possible to filter by visibility level
  • visibility level icon shows next to the user
  • forms on the left edited to look just like those on admin/projects for greater UI uniformity

screenshot from 2014-01-16 10 02 56 admin users index

admin/users/someuser: access field added

screenshot from 2014-01-16 10 03 25 admin user show

admin/users/someuser/edit: visibility level selection added

screenshot from 2014-01-16 10 06 03 admin user edit

Implementaion notes

Since this is the second public object (projects being the first) some refactoring was needed to keep things DRY:

  • visibility level specifics were separated from projects and put under shared directories

  • app/models/ability.rb was refactored to treat the user not authenticated case on a per object basis and not separately, because we have multiple cases where non authenticated users have some permissions.

    The existing behaviour should be identical, except for one "obscure" permission case: if the user is not logged in, then if subject responded to project, project would be used automatically instead independently of the subject class.

    This is not done anymore because it feels confusing, and it seems the case was not used since all tests pass.

  • help defines what is visible (public is visible to anyone, internal to any authorized user) and then talks in terms of visibility.

    This way we don't have to say "public or internal and authorized" all the time.

  • Project#visibility_level_field and Project#visibility_levels methods were removed since they were simple aliases, and their functionality was moved into Gitlab::VisibilityLevel where it can be shared between projects and users.

old description before 3rd commit

This is only left if you want to understand initial discussions. It does not reflect anymore the current state of the PR.

The index is analogous to the public project index, except that all users are public.

The public area now has a navigation panel with currently two items: public projects and public groups. The public projects section is identical to the previous public/projects URL, and the public URL still goes to public projects as before.

public-user-screenshot

The main use case for now is to find the profile of someone which you only know the name, for example to view his projects. In the future, other things could be added, such as user metrics/analytics.

Merge request reports

Loading