{ "translations": { "The given operator is invalid" : "Annettu operaattori on virheellinen", "The given regular expression is invalid" : "Määritetty säännöllinen lauseke on virheellinen", "The given file size is invalid" : "Annettu tiedoston koko on virheellinen", "The given tag id is invalid" : "Annettu tag id on virheellinen", "The given IP range is invalid" : "Annetut IP-arvot ovat virheelliset", "The given IP range is not valid for IPv4" : "Annetut IP-arvot eivät käy IPv4-osoitteisiin", "The given IP range is not valid for IPv6" : "Annetut IP-arvot eivät käy IPv6-osoitteisiin", "The given time span is invalid" : "Annettu aikaväli on virheellinen", "The given start time is invalid" : "Annettu aloitusaika on virheellinen", "The given end time is invalid" : "Annettu päättymisaika on virheellinen", "The given group does not exist" : "Annettua ryhmää ei ole", "File" : "Tiedosto", "File created" : "Tiedosto luotu", "File updated" : "Tiedosto päivitetty", "File renamed" : "Tiedosto nimetty uudelleen", "File deleted" : "Tiedosto poistettu", "File accessed" : "Tiedostoa käytetty", "File copied" : "Tiedosto kopioitu", "Tag assigned" : "Tunniste asetettu", "Someone" : "Joku", "%s created %s" : "%s loi %s", "%s modified %s" : "%s muokkasi %s", "%s deleted %s" : "%s poisti %s", "%s accessed %s" : "%s käytti %s", "%s renamed %s" : "%s nimesi uudelleen %s", "%s copied %s" : "%s kopioi %s", "Operation #%s does not exist" : "Toimenpidettä #%s ei ole olemassa", "Entity %s does not exist" : "Entiteettiä %s ei ole olemassa", "Entity %s is invalid" : "Entiteetti %s on virheellinen", "No events are chosen." : "Tapahtumia ei ole valittu.", "Entity %s has no event %s" : "Entiteetillä %s ei ole tapahtumaa %s", "Operation %s does not exist" : "Toimenpidettä %s ei ole olemassa", "Operation %s is invalid" : "Toimenpide %s on virheellinen", "Check %s does not exist" : "Tarkistusta %s ei ole olemassa", "Check %s is invalid" : "Tarkistus %s on virheellinen", "Check #%s does not exist" : "Tarkistusta #%s ei ole olemassa", "Check %s is invalid or does not exist" : "Tarkistus %s on virheellinen tai sitä ei ole olemassa", "Flow" : "Kulku", "Nextcloud workflow engine" : "Nextcloudin työnkulkumoottori", "Remove filter" : "Poista suodatin", "Select a file type" : "Valitse tiedostotyyppi", "Folder" : "Kansio", "Images" : "Kuvat", "Office documents" : "Toimisto-ohjelmistojen asiakirjat", "PDF documents" : "PDF-asiakirjat", "Custom mimetype" : "Mukautettu MIME-tyyppi", "Files WebDAV" : "Tiedostot WebDAV", "Android client" : "Android-sovellus", "iOS client" : "iOS-sovellus", "Desktop client" : "Työpöytäsovellus", "Thunderbird & Outlook addons" : "Thunderbird- & Outlook-lisäosat", "Select groups" : "Valitse ryhmät", "Groups" : "Ryhmät", "and" : "ja", "Cancel" : "Peruuta", "Delete" : "Poista", "Active" : "Aktiivinen", "Save" : "Tallenna", "Browse the App Store" : "Selaa Sovelluskauppaa", "Show less" : "Näytä vähemmän", "Show more" : "Näytä enemmän", "matches" : "täsmää", "does not match" : "ei täsmää", "is" : "on", "is not" : "ei ole", "File name" : "Tiedostonimi", "File MIME type" : "Tiedoston MIME-tyyppi", "File size (upload)" : "Tiedostokoko (lähetys)", "less" : "pienempi", "less or equals" : "pienempi tai yhtä suuri kuin", "greater or equals" : "suurempi tai yhtä suuri kuin", "greater" : "suurempi", "Request remote address" : "Pyynnön etäosoite", "matches IPv4" : "täsmää IPv4-osoitteeseen", "does not match IPv4" : "ei täsmää IPv4-osoitteeseen", "matches IPv6" : "täsmää IPv6-osoitteeseen", "does not match IPv6" : "ei täsmää IPv6-osoitteeseen", "File system tag" : "Järjestelmätunniste", "is tagged with" : "on merkitty tunnisteella", "is not tagged with" : "ei ole merkitty tunnisteella", "Request URL" : "Pyynnön URL-osoite", "Request time" : "Pyynnön aika", "between" : "välillä", "not between" : "ei välillä", "Request user agent" : "Pyynnön user agent", "is member of" : "on jäsen", "is not member of" : "ei ole jäsen", "User group membership" : "Käyttäjäryhmäjäsenyys" },"pluralForm" :"nplurals=2; plural=(n != 1);" }ers/principal_memberships_controller.rb?id=b0e17e8199bb40d0b1bed2c3dded355f439d8b3a'>plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
# frozen_string_literal: true

# Redmine - project management software
# Copyright (C) 2006-2017  Jean-Philippe Lang
#
# This program is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License
# as published by the Free Software Foundation; either version 2
# of the License, or (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.

class PrincipalMembershipsController < ApplicationController
  layout 'admin'
  self.main_menu = false

  helper :members

  before_action :require_admin
  before_action :find_principal, :only => [:new, :create]
  before_action :find_membership, :only => [:edit, :update, :destroy]

  def new
    @projects = Project.active.all
    @roles = Role.find_all_givable
    respond_to do |format|
      format.html
      format.js
    end
  end

  def create
    @members = Member.create_principal_memberships(@principal, params[:membership])
    respond_to do |format|
      format.html { redirect_to_principal @principal }
      format.js
    end
  end

  def edit
    @roles = Role.givable.to_a
  end

  def update
    @membership.attributes = params.require(:membership).permit(:role_ids => [])
    @membership.save
    respond_to do |format|
      format.html { redirect_to_principal @principal }
      format.js
    end
  end

  def destroy
    if @membership.deletable?
      @membership.destroy
    end
    respond_to do |format|
      format.html { redirect_to_principal @principal }
      format.js
    end
  end

  private

  def find_principal
    principal_id = params[:user_id] || params[:group_id]
    @principal = Principal.find(principal_id)
  rescue ActiveRecord::RecordNotFound
    render_404
  end

  def find_membership
    @membership = Member.find(params[:id])
    @principal = @membership.principal
  rescue ActiveRecord::RecordNotFound
    render_404
  end

  def redirect_to_principal(principal)
    redirect_to edit_polymorphic_path(principal, :tab => 'memberships')
  end
end