ACLView.js 1.32 KB
Newer Older
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
Ext.define('PVE.dc.ACLView', {
    extend: 'Ext.grid.GridPanel',

    alias: ['widget.pveACLView'],

    initComponent : function() {
	var me = this;

	var store = new Ext.data.Store({
	    model: 'pve-acl',
	    proxy: {
                type: 'pve',
		url: "/api2/json/access/acl"
	    },
	    sorters: { 
		property: 'path', 
		order: 'DESC' 
	    }
	});

	var render_ugid = function(ugid, metaData, record) {
	    if (record.data.type == 'group') {
		return '@' + ugid;
	    }

	    return ugid;
	};

	Ext.apply(me, {
	    store: store,
	    stateful: false,
	    viewConfig: {
		trackOver: false
	    },
	    columns: [
		{
		    header: 'Path',
		    width: 200,
		    sortable: true,
		    dataIndex: 'path'
		},
		{
		    header: 'User/Group',
		    width: 200,
		    sortable: true,
		    renderer: render_ugid,
		    dataIndex: 'ugid'
		},
		{
		    header: 'Role',
		    width: 150,
		    sortable: true,
		    dataIndex: 'roleid'
		},
		{
		    header: 'Propagate',
		    width: 80,
		    sortable: true,
		    dataIndex: 'propagate'
		}
	    ],
	    listeners: {
		show: function() {
		    store.load();
		}
	    }
	});

	me.callParent();
    }
}, function() {

    Ext.define('pve-acl', {
	extend: 'Ext.data.Model',
	fields: [ 
	    'path', 'type', 'ugid', 'roleid', 
	    { 
		name: 'propagate', 
		type: 'boolean'
	    } 
	]
    });

});