It looks like the UI code doesn't need to change as the list of events are fetched from the NotificationSetting model
The change_project_access_level and change_group_access_level events need to be added to the NotificationSetting model
Once that's in place we just need to update the conditions here to account for the custom permissions setting at the group-level and project-level.
For example (for group-level):
def post_update_hook if access_level_changed? and self.user.notification_settings_for(self.group).events[:change_group_access_level] notification_service.update_group_member(self) end super end
Link issues together to show that they're related or that one is blocking others.
Learn more.
Activity
Sort or filter
Newest first
Oldest first
Show all activity
Show comments only
Show history only
username-removed-393947Changed title: Can we disable notifications for permission changes? → Can we disable notifications for user permission level changes?
Changed title: Can we disable notifications for permission changes? → Can we disable notifications for user permission level changes?
@jschatz1@rspeicher The entire point of the "Custom" notification level is to allow people more fine grained control over what notifications they will and won't receive, so in this configuration is a feature :) That doesn't mean that we should add configuration options for every notification type though, you can't disable the "new SSH key was added to your profile" notification either for example, because that's a security feature.
I'm also not sure if this notification type, if we were to add it, makes sense per-user on a per-group and per-project level. It seems like a global preference per user, or for all of GitLab (which we likely won't add a configuration option for).
@dandunckelman Can you help me understand why you want this feature?
@DouweM we provide an "IaaS" platform and use Gitlab to store info about each of our users' "applications". We allow our users to browse Gitlab via SSO with "guest" level access so we can interact together via Issues. We prefer the "guest" access level instead of something more elevated to help prevent them from making changes directly in Gitlab when we have our own UI for controlling their Gitlab project's code (our users are generally non-developers with little to no git experience).
When a user makes changes to their "app", we use the Gitlab gem to change their "project". In order to do this, we change their access level from "guest" to "master" so the requested changes are attributed back to their user. Once all changes have been made, their access level is then changed back from "master" to "guest".
We've been wanting to enable email notifications for own benefit & our customers, but because of the above workflow, they will receive a lot of emails saying "You've been granted 'guest' access on Project X" or "You've been granted 'master' access on Project X".
In order to do this, we change their access level from "guest" to "master" so the requested changes are attributed back to their user.
This sounds to me like a good use case for the impersonate feature. Have you already considered that? Sorry, I can't find any documentation about it to link from here.
@winniehell I can't find any docs on it as well, but that does seem like it is a fit for our use-case.
The Admin::UsersController provides the ability to impersonate, but I can't find any way to "make commits as another user" via API. Maybe that's the feature we really need.
@winniehell@dandunckelman the API has the ability to sudo to another user (from admin) which is how commits are being done as the end user. But as they are by default guests in our example, we need to
@dandunckelman Thanks for the explanation about your use-case! I don't like adding more options to support "hacky" use-cases like the one you described. As @DouweM pointed out, I see the "access granted" email as a "security" email that should always be sent.
Also, I think the custom notifications feature allows you to be notified for more events than the default events, it doesn't allow you to opt-out of default events, so it wouldn't solve your use-case (since we want to send the "access granted" emails by default)!
@DouweM@rymai please help me and @mahcsig come up with a solution that isn’t hackish and accomplishes our goal.
To add some clarity to our use case, we have a Rails app that handles the user authentication and provides a UI editor to build configuration files that we version control that forces a certain workflow so end users don’t have to learn git. Our users are mostly non-developers and our early attempts to educate them on a git workflow proved to be disastrous. We have close to 1000 projects and over 2400 non-developer users (guests) that are using GitLab through this application.
We want to use the Issues built into GitLab but don’t want to provide access to the repository contents. To accomplish this we assign Guest permissions so they can create/comment on issues, but have no file access. We do however want any changes they make to the configuration files to be attributed to them, which is why we currently go through the permission change dance.
@winniehell We are using the GitLab API to communicate as the API was one of the reasons we use GitLab in the first place. We were using Rugged in the past to access repositories directly and it got to be unwieldy.
With the current notification settings each time we commit on their behalf it triggers the sending of two emails, one when we change the permissions to allow commit and one when we change it back. Due to this we have disabled the GitLab email integration but have lost the critical functionality of notifying users of Issues when there are comments or other relevant events. This has caused us significant pain and impacted our users’ satisfaction.
After reviewing the options, there appears to be (3) directions we can head:
We are using the GitLab API to communicate as the API was one of the reasons we use GitLab in the first place. We were using Rugged in the past to access repositories directly and it got to be unwieldy.
@dandunckelman If I understand you correctly, adding the functionality I described above (manipulating author and committer) to the GitLab API would also solve your problem. Is that right?
I think we can add params to the commit API to override the commit's user name and email. After all, people can already set those to whatever they like on their local machine.
@dandunckelman Can you open an issue for that specific request?