~ubuntu-branches/ubuntu/utopic/eiciel/utopic

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
/*
    Eiciel - GNOME editor of ACL file permissions.
    Copyright (C) 2004-2014 Roger Ferrer Ibáñez

    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
*/
#ifndef EICIEL_MAIN_CONTROLER_HPP
#define EICIEL_MAIN_CONTROLER_HPP

#include <config.hpp>
#include <set>
#include <glib/gi18n-lib.h>
#include "eiciel_main_window.hpp"
#include "acl_manager.hpp"
#include "acl_element_kind.hpp"

using namespace std;

class EicielWindow;

class EicielMainController : public sigc::trackable
{
    private:
        ACLManager* _ACL_manager;
        EicielWindow* _window;
        set<string> _users_list;
        set<string> _groups_list;
        bool _is_file_opened;
        bool _updating_window;
        Glib::ustring _last_error_message;

        bool _list_must_be_updated;
        bool _show_system;

        void update_acl_list();
        void update_acl_entry(ElementKind e, string name, 
                bool reading, bool writing, bool execution);
        void remove_acl(string entry_name, ElementKind e);
        void add_acl_entry(string s, ElementKind e, bool is_default);
        void change_default_acl();

        void fill_lists();
        void show_system_participants(bool b);
        void check_editable();

        set<string> get_users_list();
        set<string> get_groups_list();

        bool lookup_user(const std::string& str);
        bool lookup_group(const std::string& str);

        bool is_directory();
    public:
        void open_file(string s);
        Glib::ustring last_error();
        bool opened_file();
        friend class EicielWindow; 
        EicielMainController();
        ~EicielMainController();
};

#endif