mirror of
https://github.com/OpenNebula/one.git
synced 2025-03-08 20:58:17 +03:00
Remove old sunstone plugins files
This commit is contained in:
parent
a6c01c0a50
commit
25f40286e7
@ -1362,7 +1362,6 @@ SUNSTONE_BIN_FILES="src/sunstone/bin/sunstone-server \
|
||||
src/sunstone/bin/novnc-server"
|
||||
|
||||
SUNSTONE_ETC_FILES="src/sunstone/etc/sunstone-server.conf \
|
||||
src/sunstone/etc/sunstone-plugins.yaml\
|
||||
src/sunstone/etc/sunstone-views.yaml"
|
||||
|
||||
SUNSTONE_ETC_VIEW_FILES="src/sunstone/etc/sunstone-views/admin.yaml \
|
||||
@ -1371,8 +1370,7 @@ SUNSTONE_ETC_VIEW_FILES="src/sunstone/etc/sunstone-views/admin.yaml \
|
||||
SUNSTONE_MODELS_FILES="src/sunstone/models/OpenNebulaJSON.rb \
|
||||
src/sunstone/models/SunstoneServer.rb \
|
||||
src/sunstone/models/SunstoneMarketplace.rb \
|
||||
src/sunstone/models/SunstoneViews.rb \
|
||||
src/sunstone/models/SunstonePlugins.rb"
|
||||
src/sunstone/models/SunstoneViews.rb"
|
||||
|
||||
SUNSTONE_MODELS_JSON_FILES="src/sunstone/models/OpenNebulaJSON/HostJSON.rb \
|
||||
src/sunstone/models/OpenNebulaJSON/ImageJSON.rb \
|
||||
|
@ -1,79 +0,0 @@
|
||||
---
|
||||
- plugins/dashboard-tab.js:
|
||||
:ALL: false
|
||||
:user:
|
||||
:group:
|
||||
oneadmin: true
|
||||
- plugins/dashboard-users-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
oneadmin: false
|
||||
- plugins/config-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/system-tab.js:
|
||||
:ALL: false
|
||||
:user:
|
||||
:group:
|
||||
oneadmin: true
|
||||
- plugins/users-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/groups-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/acls-tab.js:
|
||||
:ALL: false
|
||||
:user:
|
||||
:group:
|
||||
oneadmin: true
|
||||
- plugins/vresources-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/vms-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/templates-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/images-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/files-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/infra-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/clusters-tab.js:
|
||||
:ALL: false
|
||||
:user:
|
||||
:group:
|
||||
oneadmin: true
|
||||
- plugins/hosts-tab.js:
|
||||
:ALL: false
|
||||
:user:
|
||||
:group:
|
||||
oneadmin: true
|
||||
- plugins/datastores-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/vnets-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
||||
- plugins/marketplace-tab.js:
|
||||
:ALL: true
|
||||
:user:
|
||||
:group:
|
@ -1,95 +0,0 @@
|
||||
# -------------------------------------------------------------------------- #
|
||||
# Copyright 2002-2013, OpenNebula Project (OpenNebula.org), C12G Labs #
|
||||
# #
|
||||
# Licensed under the Apache License, Version 2.0 (the "License"); you may #
|
||||
# not use this file except in compliance with the License. You may obtain #
|
||||
# a copy of the License at #
|
||||
# #
|
||||
# http://www.apache.org/licenses/LICENSE-2.0 #
|
||||
# #
|
||||
# Unless required by applicable law or agreed to in writing, software #
|
||||
# distributed under the License is distributed on an "AS IS" BASIS, #
|
||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. #
|
||||
# See the License for the specific language governing permissions and #
|
||||
# limitations under the License. #
|
||||
#--------------------------------------------------------------------------- #
|
||||
|
||||
require 'yaml'
|
||||
require 'json'
|
||||
|
||||
class SunstonePlugins
|
||||
attr_reader :plugins_conf
|
||||
|
||||
def initialize
|
||||
load_conf
|
||||
check_plugins
|
||||
end
|
||||
|
||||
def load_conf
|
||||
@plugins_conf = YAML.load_file(PLUGIN_CONFIGURATION_FILE)
|
||||
end
|
||||
|
||||
def check_plugins
|
||||
base_path = SUNSTONE_ROOT_DIR+'/public/js/'
|
||||
|
||||
@installed_plugins = Array.new
|
||||
|
||||
# read user plugins
|
||||
Dir[base_path+'user-plugins/*.js'].each do |p_path|
|
||||
m = p_path.match(/^#{base_path}(.*)$/)
|
||||
if m && m[1]
|
||||
@installed_plugins << m[1]
|
||||
end
|
||||
end
|
||||
|
||||
# read base plugins
|
||||
Dir[base_path+'plugins/*.js'].each do |p_path|
|
||||
m = p_path.match(/^#{base_path}(.*)$/)
|
||||
if m && m[1]
|
||||
@installed_plugins << m[1]
|
||||
end
|
||||
end
|
||||
end
|
||||
|
||||
def plugins
|
||||
@plugins_conf.collect{|p| p.keys[0]}
|
||||
end
|
||||
|
||||
def installed?(plugin)
|
||||
@installed_plugins.include? plugin
|
||||
end
|
||||
|
||||
def authorized_plugins(user, group)
|
||||
auth_plugins = {"user-plugins"=>Array.new, "plugins"=>Array.new}
|
||||
|
||||
@plugins_conf.each do |plugin_conf|
|
||||
plugin = plugin_conf.keys.first
|
||||
perms = plugin_conf[plugin]
|
||||
|
||||
if installed?(plugin)
|
||||
p_path, p_name = plugin.split('/')
|
||||
|
||||
if perms[:user] and perms[:user].has_key? user
|
||||
if perms[:user][user]
|
||||
auth_plugins[p_path] << p_name
|
||||
else
|
||||
next
|
||||
end
|
||||
elsif perms[:group] and perms[:group].has_key? group
|
||||
if perms[:group][group]
|
||||
auth_plugins[p_path] << p_name
|
||||
else
|
||||
next
|
||||
end
|
||||
elsif perms[:ALL]
|
||||
auth_plugins[p_path] << p_name
|
||||
end
|
||||
end
|
||||
end
|
||||
auth_plugins
|
||||
end
|
||||
|
||||
def to_json
|
||||
@plugins_conf.to_json
|
||||
end
|
||||
end
|
Loading…
x
Reference in New Issue
Block a user