Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
Projets publics
Ravada-Mirror
Commits
cb40e539
Commit
cb40e539
authored
Jan 21, 2020
by
Francesc Guasch
Browse files
wip(access): allow by accept-whatever with many options
Alse delete access can pass list issue #1213
parent
0823612c
Changes
1
Hide whitespace changes
Inline
Side-by-side
lib/Ravada/Domain.pm
View file @
cb40e539
...
@@ -4177,7 +4177,7 @@ sub _fix_default_access($self, $type) {
...
@@ -4177,7 +4177,7 @@ sub _fix_default_access($self, $type) {
sub
_mangle_client_attributes
($attribute) {
sub
_mangle_client_attributes
($attribute) {
for
my
$name
(
keys
%$attribute
)
{
for
my
$name
(
keys
%$attribute
)
{
next
if
ref
(
$attribute
->
{
$name
});
next
if
ref
(
$attribute
->
{
$name
});
if
(
$name
=~
/Accept-
Language
/
)
{
if
(
$name
=~
/Accept-
\w+
/
)
{
my
@values
=
map
{
my
$item
=
$_
;
$item
=~
s/^(.*?)[;].*/$1/
;
$item
}
my
@values
=
map
{
my
$item
=
$_
;
$item
=~
s/^(.*?)[;].*/$1/
;
$item
}
split
/,/
,
$attribute
->
{
$name
};
split
/,/
,
$attribute
->
{
$name
};
...
@@ -4250,11 +4250,28 @@ sub list_access($self, $type=undef) {
...
@@ -4250,11 +4250,28 @@ sub list_access($self, $type=undef) {
return
@list
;
return
@list
;
}
}
sub
delete_access
($self, $id_access) {
sub
delete_access
($self, @id_access) {
my
$sth
=
$$CONNECTOR
->
dbh
->
prepare
(
for
my
$id_access
(
@id_access
)
{
"
DELETE FROM domain_access
"
$id_access
=
$id_access
->
{
id
}
if
ref
(
$id_access
);
.
"
WHERE id_domain=? AND id=?
");
$sth
->
execute
(
$self
->
id
,
$id_access
);
my
$sth
=
$$CONNECTOR
->
dbh
->
prepare
(
"
SELECT * FROM domain_access
"
.
"
WHERE id=?
");
$sth
->
execute
(
$id_access
);
my
$row
=
$sth
->
fetchrow_hashref
();
confess
"
Error: domain access id
$id_access
not found
"
if
!
keys
%$row
;
confess
"
Error: domain access id
$id_access
not from domain
"
.
$self
->
id
.
"
it belongs to domain
"
.
$row
->
{
id_domain
}
if
$row
->
{
id_domain
}
!=
$self
->
id
;
$sth
=
$$CONNECTOR
->
dbh
->
prepare
(
"
DELETE FROM domain_access
"
.
"
WHERE id_domain=? AND id=?
");
$sth
->
execute
(
$self
->
id
,
$id_access
);
}
}
}
#TODO: check something has been deleted
#TODO: check something has been deleted
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment